Tuesday, March 24, 2009

list find predicate delegate .net

Here is an example how to use delegate to use for custom searching thru generic list

List<employee> ListEmployes = new List<employee>();
string strFirstName = "Mark";

Employee employeeResult = objListSomeClass.Find(delegate(Employee employee )
{
return employee.Name==strFirstName ;
}

No comments: