委托多播
来源:互联网 发布:重庆网络电视台 编辑:程序博客网 时间:2024/05/16 05:12
/* 委托可以调用多个方法,这种称为委托多播。一般时通过“+”或“-”运算符实现多播的增加或减少。 */using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{ class Program { static void Main(string[] args) { Delegt d = new Delegt(MyClass.sum); Test t = new Test(); d += new Delegt(t.sub);//委托的多播,通过+=实现 d(2, 3); Console.ReadKey(); } } delegate void Delegt(int x,int y); public class MyClass { public static void sum(int a, int b) { Console.WriteLine(a+b); } } public class Test { public void sub(int x, int y) { Console.WriteLine(x-y); } } }
0 0
- 委托及多播委托
- 委托(2.多播委托)
- 委托(五):多播委托
- 委托_多播委托
- 多播委托
- 多播委托
- 多播委托实例
- 多播委托
- 多播委托
- 委托多播
- 什么是多播委托?
- GCDMulticastDelegate多播委托
- C#--多播委托
- 多播委托
- 多播委托
- C# 多播委托
- C#多播委托
- 委托多播
- 练习3
- LeetCode#371. Sum of Two Integers(位运算)
- Java中Executor、ExecutorService、ThreadPoolExecutor介绍
- rails 不刷新上传文件jquery-fileupload-rails包的简易使用
- 玩转Excel系列-SUMIFS函数使用及实例
- 委托多播
- 第四天2017/03/31(下午2:结构体、数组)
- 类型转换
- 由FlexBox算法强力驱动的Weex布局引擎
- leetcode 421. Maximum XOR of Two Numbers in an Array
- java -封装性
- Andorid 调用H5时使用WebView的总结!
- Perfect Number
- linux 笔记