using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace MyConsoleLambda{ class Program { private static bool ShowMsg() { Console.WriteLine("Msg"); return true; } static void Main(string[] args) { int m = 100; //Funcfun = new Func (()=>ShowMsg()); //if (fun()) // Console.WriteLine("true");//输出true; //Action fun = new Action(() => m = 1000); //fun();//输出1000 // Func fun = new Func (() => m = 10000); // int res = fun(); // Console.WriteLine("res="+res+"\tm="+m);//输出res=10000 m=10000 Action fun = new Action(() => m == 1000);//出错 fun();//输出1000 //结论Lambda表达式,右边的表达式可以有返回值,也可以没有返回值 Console.Read(); } }}