Yes I\'ve seen this but I couldn\'t find the answer to my specific question.
Given a lambda testLambda that takes T and returns a boolean (I can mak
I'm a little late to the game, but I like extension methods:
public static class FuncHelper
{
public static Predicate ToPredicate(this Func f)
{
return x => f(x);
}
}
Then you can use it like:
List list = new List { 1, 3, 4, 5, 7, 9 };
Func isEvenFunc = x => x % 2 == 0;
var index = list.FindIndex(isEvenFunc.ToPredicate());
Hmm, I now see the FindIndex extension method. This is a little more general answer I guess. Not really much different from the ConvertToPredicate either.