Create IEnumerable<T>.Find()
Posted
by Brian
on Stack Overflow
See other posts from Stack Overflow
or by Brian
Published on 2010-06-03T20:46:30Z
Indexed on
2010/06/03
20:54 UTC
Read the original article
Hit count: 266
I'd like to write:
IEnumerable<Car> cars;
cars.Find(car => car.Color == "Blue")
Can I accomplish this with extension methods? The following fails because it recursively calls itself rather than calling IList.Find().
public static T Find<T>(this IEnumerable<T> list, Predicate<PermitSummary> match)
{
return list.ToList().Find(match);
}
Thanks!
© Stack Overflow or respective owner