using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace ConsoleApplication17
{
public delegate string testDelegate(string a, int b);
class Program
{
static void Main(string[] args)
{
//1 C# 1 最原始的委托赋值
testDelegate t1 = new testDelegate(M); //2 C# 2 委托赋值
testDelegate t2 = delegate (string a, int b)
{
Console.WriteLine(a + b.ToString());
return a + b.ToString();
}; //3 C# 3 委托赋值(a,b值类型对应委托声明的类型)
testDelegate t3 = (a, b) =>
{
Console.WriteLine(a + b.ToString());
return a + b.ToString();
};
// 调用委托实例
t1.Invoke("测试1", );
t2.Invoke("测试2", );
t3.Invoke("测试3", );
}
static string M(string a, int b)
{
Console.WriteLine(a + b.ToString());
return a + b.ToString();
}
}
}

最新文章

  1. js 页面无滚动条添加滚轮事件
  2. 「C++11」Lambda 表达式
  3. String.getBytes()
  4. 手动安装m4, autoconf, automake, libtool
  5. C++中typename关键字的用法
  6. Some SQL basics
  7. .NET设计模式系列文章 from TerryLee
  8. 通过Jasmine和Guard自动测试JavaScript
  9. jeecg自定义按钮使用exp属性不起作用
  10. 1013. Battle Over Cities 用dfs计算联通分量
  11. 最强大的跨语言调用生成工具:Swig 快速实用教程
  12. Django——日志
  13. sqlite--一秒20万数据
  14. VUE 实现复制内容到剪贴板功能
  15. TFS SDK
  16. 除虫记之C#调用C函数出现的诡异错误
  17. CentOS下iptables详解
  18. SharePoint 如何导出部署的场解决方案
  19. css3画半圆 , 加上一点动画
  20. Workbook对象的方法总结(二)

热门文章

  1. navicat 连接报2059错误
  2. IDEA配置tomcat日志乱码
  3. Mac 安装IDEA 2018.3 版本
  4. intermediate-python-for-data-science
  5. ping和tracert
  6. Python2安装MySQLdb
  7. 控制台输出Scanner和BufferedReader区别
  8. c#字符串常用方法
  9. VNCserver 安装 及 oracle过程总结
  10. make && make install