博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C#实现的几种委托
阅读量:6880 次
发布时间:2019-06-27

本文共 1097 字,大约阅读时间需要 3 分钟。

//普通委托            DeleteShow ds = new DeleteShow(ShowName);            Console.WriteLine("----------------------");            Console.WriteLine("普通委托----请输入用户名:");            string Name = Console.ReadLine();            Console.WriteLine(ds(Name));            Console.WriteLine("----------------------");            //匿名方法委托            DeleteShow ds2 = delegate(string NewName) {                return string.Format("匿名方法委托----输入的用户名为:{0}", NewName);            };            Console.WriteLine("----------------------");            Console.WriteLine("请输入用户名:");            string WriteName = Console.ReadLine();            Console.WriteLine(ds2(WriteName));            Console.WriteLine("----------------------");            //Lambada委托            DeleteShow ds3 = (LamName) => { return string.Format("Lambada委托----输入的用户名为:{0}", LamName); };            Console.WriteLine("----------------------");            Console.WriteLine("请输入用户名:");            string WriteLamName = Console.ReadLine();            Console.WriteLine(ds3(WriteLamName));            Console.WriteLine("----------------------");

 

转载地址:http://xrubl.baihongyu.com/

你可能感兴趣的文章
jquery
查看>>
伏地魔
查看>>
linux
查看>>
安装虚拟机-linux系统步骤
查看>>
集训第五周动态规划 J题 括号匹配
查看>>
微信小程序车牌键盘
查看>>
python 网络编程
查看>>
【BZOJ】2165: 大楼
查看>>
Curso de FP Interpretacion Lenguaje de Signos a distancia.
查看>>
HTML图像
查看>>
类和对象简析
查看>>
zlog学习笔记(zc_hashtable)
查看>>
第十三章、学习 Shell Scripts 条件判断式
查看>>
php 基础语法
查看>>
log.sh
查看>>
2018——2019 20165239Exp9 Web安全基础
查看>>
图解如何用U盘重装系统
查看>>
网站架构(页面静态化,图片服务器分离,负载均衡)方案全解析
查看>>
JavaScript应用
查看>>
浏览器 兼容性 问题记录集
查看>>