Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > C/C++ > 22.2 Delegate instantiation
【标  题】:22.2 Delegate instantiation
【关键字】:22.2,Delegate,instantiation
【来  源】:http://blog.csdn.net/masterall/archive/2006/06/22/819848.aspx

22.2 Delegate instantiation

Your Ad Here An instance of a delegate is created by a delegate-creation-expression (§14.
5.10.3). The newly created delegate
instance then refers to either:
? The static method referenced in the delegate-creation-expression, or
? The target object (which cannot be null) and instance method referenced in
the delegate-creationexpression,
or
? Another delegate
[Example: For example:
delegate void D(int x);
class Test
{
public static void M1(int i) {?}
public void M2(int i) {?}
}
class Demo
{
static void Main() {
D cd1 = new D(Test.M1); // static method
Test t = new Test();
D cd2 = new D(t.M2); // instance method
D cd3 = new D(cd2); // another delegate
}
}
end example]
Once instantiated, delegate instances always refer to the same target
object and method. [Note: Remember, when
two delegates are combined, or one is removed from another, a new delegate
results with its own invocation list;
the invocation lists of the delegates combined or removed remain unchanged.
end note]
22.3 Delegate invocation:【上一篇】
22.1 Delegate declarations:【下一篇】
【相关文章】
  • 22.3 Delegate invocation
  • C# 的 Delegate 的小心得
  • C++中Delegate的简单实现
  • 14.9.8 Delegate equality operators
  • 14.5.10.3 Delegate creation expressions
  • 我理解的委托(delegate)
  • Mcad学习笔记之委托再理解(delegate的构造器,BeginInvoke,EndInvoke,Invoke4个方法的探讨)
  • Weak Delegate
  • 8.10 Delegates
  • mx.utils 包 [2] 之 Delegate类 应用
  • 【随机文章】
  • 图片上传的功能简介及web.config设置(自动生成所略图)
  • 应用易构(RichWeb)快速开发平台给用户带来的收益
  • DB2 与 JDBC
  • JavaScript支持面向对象的开发
  • 创建文件的几种方法(补充)
  • 主页被锁定为good.allxun.com的手工清除办法
  • FreeBSD Apache+Mysql+Php4的安装
  • two scripts - monitoring the usage of rollback segments of Oracle Database
  • 实现 iSCSI Target的两种方法
  • Windows2003设置
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.