zoukankan      html  css  js  c++  java
  • Lambda表达式

       //1,定义委托
            private delegate void MyDelegate(string name);

            // 2,这是我们欲传递的方法,它与MyDelegate具有相同的参数和返回值类型
            public static void MyDelegateMethod(string name)
            {
                Console.WriteLine("Hello,{0}", name);
            }

            static void Main(string[] args)
            {
                #region 委托
                //// 3,创建delegate对象
                //MyDelegate md = new MyDelegate(MyDelegateMethod);
                //// 4,调用delegate
                //md("Michael");
                #endregion

                #region 匿名方法
                //MyDelegate md = delegate(string name)
                //{
                //    Console.WriteLine("Hello,{0}", name);
                //};
                //md("Michael");

                #endregion

                #region Lambda表达式
                ////匿名委托
                //MyDelegate myDelegate =(name => Console.WriteLine("Hello,{0}", name));

                ////调用委托
                //myDelegate("Michael");

                #endregion
            }

  • 相关阅读:
    2016.11.30
    java韩顺平老师视频有需要可以留言
    UESTC 1425 Another LCIS
    hdu 3308 LCIS
    HDU 3308 LCIS 线段树区间更新
    poj crane
    poj1436 Horizontally Visible Segments
    编程习惯记录
    poj 3225 Help with Intervals
    UVA 1513 Movie collection
  • 原文地址:https://www.cnblogs.com/914556495wxkj/p/4361195.html
Copyright © 2011-2022 走看看