C# Lambda 表达式 =>

从简单的例子来看:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<string> greet = () => "Hello, World!";
            Console.WriteLine(greet());
            Console.ReadLine();
        }
    }
}

这句

Func<string> greet = () => "Hello, World!";

到底是什么意思?

  • https://docs.microsoft.com/zh-cn/dotnet/csharp/language-reference/operators/lambda-operator
  • https://blog.csdn.net/zxf347085420/article/details/92803539
  • https://mp.weixin.qq.com/s/1rYTS2iAN17ksHOjCIoE5A

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.