• c#之委托所有方法


    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] + """;
                }
            }
        }
    }
    

      

  • 相关阅读:
    windows XP 下的DTRACE 跟踪 学习
    copy to tmp table
    快麦
    SQL SERVER BOOK
    启锐电子面单驱动
    grep---find
    mysql中kill掉所有锁表的进程
    sqlserverinternals.com
    从顺序随机I/O原理来讨论MYSQL MRR NLJ BNL BKA
    解析MYSQL BINLOG二进制格式
  • 原文地址:https://www.cnblogs.com/mengluo/p/5519296.html
Copyright © 2020-2023  润新知