Friday, July 20, 2012

Predicate vs. Func

Predicate is just a special cased Func<T, bool> really, introduced before all of the Func and most of the Action delegates came along. I suspect that if we'd already had Func and Action in their various guises, Predicate wouldn't have been introduced... although it does impart a certain meaning to the use of the delegate, whereas Func and Action are used for widely disparate purposes.
Jon Skeet - http://stackoverflow.com/questions/4317479/func-vs-action-vs-predicate

See example usage in Array.Find<T>:
http://msdn.microsoft.com/en-us/library/bfcke1bz.aspx

No comments:

Post a Comment