It is mainly to combine the two sets of numbers into the list <T> (generic) for search and sorting.Example
Search for List <Person> people = new List <Person> ();
People. Add (new Person (50, "Fred "));
People. Add (new Person (30, "John "));
People. Add (new Person (26, "Andrew "));
People. Add (new Person (24, "Xavier "));
People. Add (new Person (5, "Mark "));
People. Add (new Person (6, "Cameron "));
List <Person> young = people. FindAll (delegate (Person p) {return p. age <25 | p. name. Contains ("F ");});
Note:The above code is to search for records at 25 age, or whose names contain the "F" letter. Be sure to have a return statement and do not report an error!
SortPeople. Sort (delegate (Person p1, Person p2) {return p1.age. CompareTo (p2.age );});
Note:The above code is sorted by age in ascending order, and the positions of p1.age and p2.age are changed to descending order.
For example, people. Sort (delegate (Person p1, Person p2) {return p2.age. CompareTo (p1.age );});