小编Rya*_*yan的帖子

谓词<T>超过Func <T,bool>的优势?

使用谓词而不是普通委托有什么价值吗?以下面的例子,我没有看到任何.

Predicate<int> isEven = delegate(int x) { return x % 2 == 0; };
Console.WriteLine(isEven(1) + "\r\r");

Func<int, bool> isEven2 = delegate(int x) { return x % 2 == 0; };
Console.WriteLine(isEven(1) + "\r\r");
Run Code Online (Sandbox Code Playgroud)

.net c# delegates

5
推荐指数
1
解决办法
1572
查看次数

标签 统计

.net ×1

c# ×1

delegates ×1