Is Predicate available anywhere in .NET? From MSDN http://msdn.microsoft.com/en-us/library/bfcke1bz.aspx, I don’t see a Predicate anywhere. I see an anonymous that returns a boolean but no generics or a “Predicate” keyword.
Is Predicate available anywhere in .NET? From MSDN http://msdn.microsoft.com/en-us/library/bfcke1bz.aspx , I don’t see a
Share
Rather than inline a delegate for the predicate, you could use it as a type then pass it in. Here’s an example:
EDIT: to declare the Predicate with an existing method, you would use:
The alternatives, which are more common, would’ve been:
EDIT: to answer your other question in a comment to another post, a delegate is a type that defines a method signature and can be used to pass methods to other methods as arguments. If you’re somewhat familiar with C++, they are like function pointers. For more info on delegates check out this MSDN page.