在C#标准代表 [英] Standard delegates in C#

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

问题描述

有一些代表在C#中预定义

There are some Delegates predefined in C#

我知道这些:

EventHandler // Default event callbacks
EventHandler<T> // Default event callbacks with custom parameter (inheriting from EventArgs)
Action // Function without return value and without parameter
Action<T1, T2, T3, T4> // Function without return value and 1-4 parameters
Func<T1, T2, T3, T4, TResult> // Methos with 0-4 parameters and one result type
Predicate<T> // equivalent to Func<T, bool>

有许多更特殊情况及该框架的生成形式部分,但是这些通常是好自我编写的代码使用。

There are many more for special cases and generated form parts of the framework, but these are often good to use in self written code.

如果你知道一些有用的添加。否则,这就是答案。

If you know some more useful add them. Otherwise this is answered.

推荐答案

他们不是在C#中预定义。他们通过的框架

They're not predefined in C#. They're defined by the framework.

动作和<$ C $定义C>函数功能委托家庭更宽比你已经证明 - 他们去到

The Action and Func delegate families are wider than you've shown - they go up to

Action<T1, T2, T3, T4>

Func<T1, T2, T3, T4, TResult>



另一种常见的杂交之一,.NET 2.0列表操作(LINQ前)谓词< T>

有关使用线程:

ThreadStart
ParameterizedThreadStart
WaitCallback
TimerCallback
AsyncCallback

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

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