C#表达混乱 [英] C# Expression Confusion

查看:105
本文介绍了C#表达混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下声明的问题:



 T  Single < T> (表达式< Func< T,bool>>表达式,参数表达式< Func< T,对象>> []包括) where  T: class ; 





现在我知道T是泛型类型,但我没有得到的是Expression和params数据类型。谷歌搜索他们什么都没有。关于它们的任何解释都是非常受欢迎的。



提前致谢。

解决方案

Expression params 是数据类型:前者类似于Func但返回树而不是值(有一个很好的描述这里: http://stackoverflow.com/questions/793571/why-你愿意使用表达式 - 而不是功能性的 [ ^ ])。



params 是一个C#关键字,允许您指定采用可变数量参数的方法参数。 MSDN是您的第一个资源: http://msdn.microsoft.com/en-us/library/w5zay9db .aspx [ ^ ]

Hi, i have a problem with following declaration:

T Single <T> ( Expression <Func<T, bool>> expression, params Expression <Func <T, object>>[] includes ) where T : class;



Now i get it that T is a generic type but what i don't get are the "Expression" and "params" data types. Googling about them came up with nothing. Any explanation about them is very welcome.

Thanks in advance.

解决方案

Neither the Expression or the params are datatypes: the former is similar to Func but returns a tree rather than a value (There is a good description here: http://stackoverflow.com/questions/793571/why-would-you-use-expressionfunct-rather-than-funct[^]).

params is a C# keyword that lets you specify a method parameter that takes a variable number of arguments. MSDN is your first resource here: http://msdn.microsoft.com/en-us/library/w5zay9db.aspx[^]


这篇关于C#表达混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆