什么是代表?它是如何工作的? [英] What is a delegate? and how it work?

查看:82
本文介绍了什么是代表?它是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,



我需要了解代表。



什么是代表?

如何运作?



关于

Greetings,

I need to know about delegate.

What is a delegate?
How it works?

Regards

推荐答案

尽管明显简单自然使用代表,他们一点也不琐碎。



请查看我对代表性质的回答:

关于代表的讨论 [ ^ ],

在C#中使用N参数作为参数的方法 [ ^ ],

...以及他们的角色和用途:
代表的额外优势是什么? [ ^ ],

代表在C#.NET中有什么优势? [ ^ ]。



参见a我在CodeProject文章中关于代理性质的部分:动态方法调度程序 [< a href =http://www.codeproject.com/Articles/203453/Dynamic-Method-Dispatcher#a4.1target =_ blanktitle =New Window> ^ ]。



祝你好运,
-SA
Despite the apparent simplicity of natural use of delegates, they are not trivial at all.

Please see my answers on the nature of delegates:
Confusion about delegates[^],
Pass a method with N params as parameter in C#[^],
…and on their role and use:
What is the Extra Advantage of Delegate[^],
What are the advantages of delegates in C#.NET?[^].

See also a section on the nature of delegates in my CodeProject article: Dynamic Method Dispatcher[^].

Good luck,
—SA


您好,



您可以在这里看到:

http://geekswithblogs.net/joycsharp/archive/2008/02/ 15 / simple-c-delegate-sample.aspx [ ^ ]



或者你只是谷歌它,并有很多参考:

DELEGATE [ ^ ]





希望能帮助到你! :)
Hi,

You can see it here:
http://geekswithblogs.net/joycsharp/archive/2008/02/15/simple-c-delegate-sample.aspx[^]

Or you just can google it, and have a lots of references:
DELEGATE[^]


Hope it helps! :)


Delegate就像一个类型,指向对象中方法的引用。它就像一个函数指针。



代表类似于函数指针。它是一个引用类型变量,它保存对可在运行时更改的方法的引用。它们用于实现事件和回调方法。所有委托都是从System.Delegate类隐式派生的。
Delegate is a like a type which point to the reference of a method in an object.It is like as a function pointer.

Delegates are similar to pointers to functions. It is a reference type variable which holds the reference to a method which can be changed at runtime. They used for implementing events and the call-back methods. All delegates are implicitly derived from the System.Delegate class.


这篇关于什么是代表?它是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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