Lambda表达式的本质

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();
        //}
    }
}

踏实做一个为人民服务的搬运工!
原文地址:https://www.cnblogs.com/LifeDecidesHappiness/p/14594718.html