Reputation: 77
I am calling a filtering method that accepts parameter Predicate T
void MethodName(Predicate<T> param)
{
}
x.MethodName(x => x.SomeProperty == 10); // or
x.MethodName(delegate(MyClass x) {return x.SomeProperty == 10;});
The problem is that I need to be able to filter on several different values, and the number of values is unknow. Example with 3 values ouwld be
x.MethodName(x => x.SomeProperty == 10 || x => x.SomeProperty == 20); // or
x.MethodName(delegate(MyClass x) {return x.SomeProperty == 10 || x.SomeProperty == 20;});
Can I make it work with uknown number of possible values? This would be greate, but its not possilbe :)
x.MethodName(x => x.SomeProperty == {10, 20});
Upvotes: 2
Views: 3000