委托学习笔记:最简单的委托
2006-12-20 14:28
204 查看
using System;
using System.Collections.Generic;
using System.Text;
namespace 委托
{
class Program
{
public delegate void Del(string message);
//public delegate void SortDelegate(int[] SortArray);
public static void Show(string message)
{
Console.WriteLine(message);
}
static void Main(string[] args)
{
Del handler = new Del(Show);
handler("委托给Show");
MethodWithCallBack(1, 5, handler); //异步回调
}
public static void MethodWithCallBack(int param1,int param2,Del callback)
{
callback("the number is "+Convert.ToString(param1+param2));
}
}
}
using System.Collections.Generic;
using System.Text;
namespace 委托
{
class Program
{
public delegate void Del(string message);
//public delegate void SortDelegate(int[] SortArray);
public static void Show(string message)
{
Console.WriteLine(message);
}
static void Main(string[] args)
{
Del handler = new Del(Show);
handler("委托给Show");
MethodWithCallBack(1, 5, handler); //异步回调
}
public static void MethodWithCallBack(int param1,int param2,Del callback)
{
callback("the number is "+Convert.ToString(param1+param2));
}
}
}
相关文章推荐
- ios自用学习笔记一委托协议的简单了解
- Linux——vim/vi 简单学习笔记
- python学习笔记:easygui的简单示例
- python 学习笔记简单线程池实现
- Node.js学习笔记(5)--文件简单操作
- 链接脚本学习笔记1------sections的简单应用分析
- 委托,文件流,扩展方法学习笔记
- [ASP.NET学习笔记之二十二].NET中的委托与事件研究
- HTML学习笔记:WEB表单简单示例与表格化的表单
- c#网络编程学习笔记02_Tcp编程(中)_简单的同步tcp聊天程序
- C#学习笔记之简单工厂设计模式
- 【批处理学习笔记】第七课:简单的批处理命令(6)
- python学习笔记-简单的图片上传及加水印
- Mcad学习笔记之异步编程(AsyncCallback委托,IAsyncResult接口,Begin
- ”Python开发简单爬虫“慕课网课程学习笔记1
- Hive学习笔记-API简单操作
- Java菜鸟学习笔记--面向对象篇(十二):Package简单理解
- JavaScript 学习笔记3 CSS的ID、CLASS简单应用
- Linux——软件包简单学习笔记
- JasperReport学习笔记2-创建简单的报表例子