首页 > 其他 > 详细

Lambda表达式的本质

时间:2021-03-30 09:29:03      阅读:29      评论:0      收藏:0      [点我收藏+]
using System;

namespace ConsoleApp
{
    internal class Program
    {
        private static void Main()
        {
            Console.Title = "Lambda表达式的本质";

            void DoSthWithLi(Func<string, string> doSth)
            {
                var name = "";
                var result = doSth(name);
                Console.WriteLine(result);
            }

            DoSthWithLi(name => name + "爱你");
            Console.ReadLine();
        }


        //private static void Main(string[] args)
        //{
        //    void DoSthWithLi(Func<string, string> doSth)
        //    {
        //        var name = "我";
        //        var result = doSth(name);
        //        Console.WriteLine(result);
        //    }

        //    string WhoLovesYou(string name)
        //    {
        //        return name + "爱你";
        //    }

        //    DoSthWithLi(WhoLovesYou);
        //    Console.ReadLine();
        //}
    }
}

技术分享图片

技术分享图片

Lambda表达式的本质

原文:https://www.cnblogs.com/LifeDecidesHappiness/p/14594718.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!