22. Delegates

原创 2006年06月22日 03:18:00
[Note: Delegates enable scenarios that other languages?such as C++, Pascal,
and Modula?have addressed with
function pointers. Unlike C++ function pointers, however, delegates are
fully object oriented, and unlike
C++ pointers to member functions, delegates encapsulate both an object
instance and a method. end note]
A delegate declaration defines a class that is derived from the class
System.Delegate. A delegate instance
encapsulates one or more methods, each of which is referred to as a
callable entity. For instance methods, a
callable entity consists of an instance and a method on that instance. For
static methods, a callable entity consists
of just a method. Given a delegate instance and an appropriate set of
arguments, one can invoke all of that
delegate instance?s methods with that set of arguments.
[Note: An interesting and useful property of a delegate instance is that it
does not know or care about the classes
of the methods it encapsulates; all that matters is that those methods be
compatible (§22.1) with the delegate?s
type. This makes delegates perfectly suited for ?anonymous? invocation. end
note]
版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

DOTNETc# 委托 delegates

首先来理解下委托的定义委托是一种引用方法的类型。也就是分配在一旦为委托分配栈中,委托将与该方法具有完全相同的行为。委托方法的使用可以像其他任何方法一样,具有参数和返回值,如下面的示例所示: C# pu...

开发该选择Blocks还是Delegates

原文链接:http://www.cnblogs.com/qiyer/p/4844564.html 有人问了我一个很棒的问题,我把这个问题总结为:“开发过程中该选择 blocks or d...

Creating and Using Your Own Delegates in Objective-C

I've been doing iPhone development for about a year now and have used the delegation pattern many ti...

C# events vs. delegates

We have looked at delegates and their implementation in two previous articles. But if you searched s...

开发该选择Blocks还是Delegates

转载至:http://www.cocoachina.com/ios/20150927/13525.html 原文链接:http://blog.stablekernel.com/blocks-or-de...

Delegates and Events in C# / .NET

Content Overview Delegates Call a Function directly - No Delegate The very basic Delegate C...

Events and Delegates(事件和委托)

Introduction One of the most interesting concepts in C# is Event-Driven approach. Though it is a si...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)