Many of you are asking how to perform searches on lists as detailed in the previous post using C# syntax. Well in a summary form this would be the equivalent expression:
Muchos de vosotros me estáis pidiendo como realizar búsquedas en listas como la detallada en el post anterior y en C#. Bien de una forma resumida esta sería la expresión equivalente :
public static List<Person> People = new List<Person> … // to do: Populate list
// Find name function
public static Person FindField(string toFind)
{
Person result = People.Find(delegate(Person fl) {return fl.Name == toFind;});
return result;
}
// ..
// ..
// ..
// Class Person
public class Person
{
public string Name { get; set; }
public string surname { get; set; }
public int Age { get; set; }
}
I hope this will be useful,
Pep Lluis,