What is the difference between a lambda expression and a predicate in .NET?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
Predicate defines a set of criteria, while lambda expression is an anonymous function. You can use lambda ex. as a predicate, but that doesn't mean they are the same thing.
Predicate
Lambda expression
A predicate is delegate (function object) that returns a boolean value. Lambda expressions can be used to define any anonymous function, which includes predicates, e.g. to express a predicate in the form of a lambda expression:
which is functionally equivalent to: