c#之委托所有方法
2016-05-23 11:27
465 查看
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { public delegate void ceshi(string[] names); class Program { static void Main(string[] args) { string[] a = { "abCdeg", "ssxAf" }; //第一种 //ProStrSYH(a); //ProStrToLower(a); //ProStToUpper(a); //ceshi aaax = new ceshi(ProStToUpper); //for (int i = 0; i < a.Length; i++) //{ // Console.WriteLine(a[i]); //} //第二种 //ceshi aX = ProStToUpper; //aX(a); //第三种 //ceshi sayhi = delegate(string[] names) //{ // for (int i = 0; i < a.Length; i++) // { // Console.WriteLine(a[i].ToUpper()); // } //}; //sayhi(a); //lamda 表达式写法 =>goes to 滚 ceshi sa = (string[] names) => { for (int i = 0; i < a.Length; i++) { Console.WriteLine(a[i].ToUpper()); } }; sa(a); Console.ReadKey(); } public static void ProStToUpper(string[] name) { for (int i = 0; i < name.Length; i++) { name[i] = name[i].ToUpper(); } } public static void ProStrToLower(string[] name) { for (int i = 0; i < name.Length; i++) { name[i] = name[i].ToLower(); } } public static void ProStrSYH(string[] names) { for (int i = 0; i < names.Length; i++) { names[i] = "\"" + names[i] + "\""; } } } }
相关文章推荐
- C#多线程之二:ManualResetEvent和AutoResetEvent
- c#之构造函数
- C#中A a=new B()的意义
- C#:操作xml文件
- C#-using用法详解
- C#中字符数组,字节数组和string之间的转化
- C#委托与事件讲解(一)
- C#之线程同步方法
- DES对称数据加密
- c#webservice的创建发布调用示例
- C# CodeFirst编程模型一
- 微软消息队列(MSMQ)配置使用小结(c#)
- C# 抓取网页内容的方法
- C#日期时间格式化
- C#面向对象理解
- C#知识点-委托
- C#字符串Split方法的误区
- C#与闭包
- 吉日嘎拉C#快速开发平台V4.0到V4.2升级记
- Dos命令编译C#文件