Created
December 24, 2010 14:17
-
-
Save follesoe/754265 to your computer and use it in GitHub Desktop.
Learn the language, live the lifestyle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Create a list of persons | |
| List<Person> persons = new List<Person>(); | |
| persons.Add(new Person("Jonas", "Follesø")); | |
| persons.Add(new Person("Hege", "Røkenes")); | |
| persons.Add(new Person("Håvard", "Sørbø")); | |
| persons.Add(new Person("Gøran", "Hansen")); | |
| //... more persons go here .../ | |
| //C# 2.0 - Using an anonomous method to filter persons that starts with "J" | |
| List<Person> jPersons = persons.FindAll(delegate(Person p) { return p.Name.StartsWith("J"); }); | |
| //C# 3.0 - Creating a function using lambda to filter persons that starts with "H" | |
| List<Person> hPersons = persons.FindAll(p => p.Name.StartsWith("H")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment