之间的拉姆达EX pression和predicate在.net的区别是什么?

问题描述:

之间的lambda EX pression和predicate在.net的区别是什么?

What is the difference between a lambda expression and a predicate in .NET?

一个predicate是委托(函数对象)返回一个布尔值。 可以用来 LAMBDA EX pressions定义任何匿名函数,其中包括predicates,例如:能恩preSS一个predicate在一个lambda EX pression形式:

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:

Predicate<int> isEven2 = x => x % 2 == 0;

这在功能上等同于:

which is functionally equivalent to:

Func<int,bool> isEven = x => x % 2 == 0;