Well, there are Linq extension methods .Where(to match all that match) and .FirstOrDefault(to get the first match), or you can write your own extension method against IList, for example:
public static class IListExtensions
{
public static T FindFirst<T>(this IList<T> source, Func<T, bool> condition)
{
foreach(T item in source)
if(condition(item))
return item;
return default(T);
}
}
source
share