C#Func功能 [英] C# Func features

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

问题描述

大家好,

您能否提供C#Func的功能?

在此先感谢.

Hi all,

Could you please provide the features of C# Func?

Thanks in advance.

推荐答案

我什至要解释为什么这是一个不正确的问题? (请参阅我对该问题的评论.)

类型没有优点"或缺点",它们符合或不符合某些目的.标识符Func不是类型;这是一组不同但相似的通用类型.请参阅:
http://msdn.microsoft.com/en-us/library/system.aspx [ ^ ].

另请参见同一页面上的Action通用委托.两种最简单的泛型类型Func和两种最简单的泛型类型Action的帮助页面包含带注释的代码示例.

浏览到他们的定义或查看他们的描述以了解它的含义.这些类型的目的是极大的方便;很少会使用通用委托人签名,而其他则是预定义的.任何人都可以在需要的地方定义那些泛型或非泛型类型,而不会出现任何问题或损失.

您真正需要的是对如何提问的一些理解.请参阅以下讨论:
如何问一个好问题? [ ^ ].

建议您查看一些规则:
代码项目常见问题解答 [如何使用Google和其他查找编程的技巧帮助 [ ^ ]
在论坛中发布问题的一些准则 [ ^ ].

祝你好运,
—SA
Should I even explain why this is an incorrect question? (Please see my comment to the question.)

Types do not have "advantages" or "disadvantages", they do or do not fit certain purposes. The identifier Func is not a type; this is a set of different but similar generic types. Please see:
http://msdn.microsoft.com/en-us/library/system.aspx[^].

See also Action generic delegates on the same page. The help pages on two simplest generic types Func and two simplest generic types Action contain well annotated code samples.

Browse to their definitions or see their descriptions to see what is it. The purpose of these type is sheer convenience; few generic delegate signatures which are more likely to be used then others are predefined. Anyone could define those generic or non-generic type where they are required, without any problems or losses.

What you really need is some understanding of how to ask questions. Please see this discussion:
How to ask a good question?[^].

You are recommended to review some rules:
Code Project Questions and Answers FAQ[^]
How to Use Google and Other Tips for Finding Programming Help[^]
Some guidelines for posting questions in the forums[^].

Good luck,
—SA


您可能会看到以下提示Action ,但是您只需稍作改动就可以使用Func .

这可以为您提供Asp.Net中Action Func 用法的方向.

希望对您有所帮助:)
You might have a look this Tips Invoke a ASP.NET page method from a User Control[^].

Note: In the Tips, Action has been used but you could use Func as well by little change.

This could be give you a direction of the Usage of the Action or Func in Asp.Net.

Hope it helps :)


它不是特定于ASP.NET的,而是C#的东西.

您可以使用此委托来表示可以作为参数传递的方法,而无需显式声明自定义委托.

此处的详细信息:
MSDN:Func< t,>委托 [ ^ ]
样本在文档中提供.您可以根据需要使用它.
It''s not ASP.NET specific instead it''s a C# thingy.

You can use this delegate to represent a method that can be passed as a parameter without explicitly declaring a custom delegate.

Details here: MSDN: Func<t,> Delegate[^]
Samples are given in the documentation. You can use it as per your need.


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

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