Delegate至少0个参数,至多32个参数,可以无返回值,也可以指定返回值类型。这个是祖宗。
  Func可以接受0个至16个传入参数,必须具有返回值。
  Action可以接受0个至16个传入参数,无返回值。
  Predicate只能接受一个传入参数,返回值为bool类型。

public delegate bool Predicate<in T>(T obj);
public delegate TResult Func<in T, out TResult>(T arg);
Func<T, bool> :表示有传入T类型的参数,返回值为bool的委托
Predicate<T>:表示有传入T类型的参数,返回值为bool的委托
static void Main(string[] args)
{
Predicate<int> myPredicate = i => i > ;
Func<int, bool> myFunc = i => i > ;
List<int> list = new List<int>();
list.Add();
list.Add();
list.Add();
list.Add();
List<int> newList = list.FindAll(myPredicate);
List<int> newListFunc = list.Where(myFunc).ToList();
Console.ReadKey();
}
看到Predicate和Func接受的是完全相同的Lambada表达式,
而且执行结果newList和newListFunc完全相同。
 
http://blog.csdn.net/rye_grass/article/details/66041423  C#中的Predicate<T>与Func<T, bool>

(转)C#中的Predicate<T>与Func<T, bool>的更多相关文章

  1. C#中Predicate<T>与Func<T, bool>泛型委托的用法实例

    本文以实例形式分析了C#中Predicate<T>与Func<T, bool>泛型委托的用法,分享给大家供大家参考之用.具体如下: 先来看看下面的例子: 1 2 3 4 5 6 ...

  2. Predicate<T>与Func<T, bool>泛型委托

    引用别人的: static void Main(string[] args) { List<string> l = new List<string>(); l.Add(&quo ...

  3. .NET Core中合并Expression<Func<T,bool>>的正确姿势

    这是在昨天的 .NET Core 迁移中遇到的问题,之前在 .NET Framework 中是这样合并 Expression<Func<T,bool>> 的: public s ...

  4. 表达式拼接Expression<Func<IEntityMapper, bool>> predicate

    /// <summary> /// 重写以筛选出当前上下文的实体映射信息 /// </summary> protected override IEnumerable<IE ...

  5. EF Core 封装方法Expression<Func<TObject, bool>>与Func<TObject, bool>区别

    unc<TObject, bool>是委托(delegate) Expression<Func<TObject, bool>>是表达式 Expression编译后就 ...

  6. lambda表达式Expression<Func<Person, bool>> 、Func<Person, bool>区别

    前言: 自己通过lambda表达式的封装,将对应的表达式转成字符串的过程中,对lambda表达式有了新的认识 原因: 很多开发者对lambda表达式Expression<Func<Pers ...

  7. .NetCore 扩展封装 Expression<Func<T, bool>> 查询条件遇到的问题

    前面的文章封装了查询条件 自己去组装条件,但是对 And  Or  这种组合支持很差,但是也不是不能支持,只是要写更多的代码看起来很臃肿 根据 Where(Expression<Func< ...

  8. Entity Framework 动态构造Lambda表达式Expression<Func<T, bool>>

    using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; us ...

  9. Expression<Func<T, bool>>与Func<T, bool>的区别

    转自:http://www.cnblogs.com/wow-xc/articles/4952233.html Func<TObject, bool>是委托(delegate) Expres ...

随机推荐

  1. Oracle数据库信息查询

    查看当前数据库 select name from V$DATABASE; select SYS_CONTEXT('USERENV','INSTANCE_NAME') from dual; 用户 sel ...

  2. 如何使用Octave 在Ubuntu上科学处理音频

    Octave 是一个类似于 Linux 上的 Matlab 的软件,它拥有数量众多的函数和命令,支持声音采集.记录.回放以及音频信号的数字化处理,用于娱乐应用.研究.医学以及其它科学领域.在本教程中, ...

  3. (转)ngui3.5.7 版本Scroll View实现方法

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://xyo123.blog.51cto.com/6369437/1405861 现在网 ...

  4. PREEMPT_RT的未来

    因为开发资金的问题,Thomas Gleixner宣布他已经不想干了. 商业公司往往用了PREEMPT_RT的功能去不愿意去回报社区,那就自己弄吧. http://lwn.net/Articles/6 ...

  5. 简单账本-用完即走的微信小程序

    作为一个记账强迫症患者,对当前手机中的记账App都不太满意.这类软件越来越臃肿,越来越慢,启动要半天.联网同步要半天,进入界面又有一堆新功能要介绍.好不容易开始记账,又得各种高大上的选择设定,一笔帐下 ...

  6. (LeetCode 160)Intersection of Two Linked Lists

    Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...

  7. Python中的乱码

        我把写好的Python脚本导入到ArcGIS中的ToolBox中,在本机测试是没有问题的.为了把工具分享给其他人,即在其他电脑上使用,我必须将脚本文件(*.py)导入到工具箱文件(*.tbx) ...

  8. 拓展javascript内置函数

    1.获取字符串字节数 //获取字符串字节数 //方法一 /* */ String.prototype.getBytesLength = function () { var length = 0; fo ...

  9. 队列实例程序(C语言)

    /* queue.h */ #ifndef _QUEUE_H #define _QUEUE_H struct queue_record; typedef struct queue_record *qu ...

  10. VS2010没有Intellisense(智能感知)的解决办法

    VS2010没有Intellisense(智能感知)的解决办法 Visual Studio 2010 的Intellisense是依赖于Microsoft SQL Server Compact 3.5 ...