jjzjj

makeOutput

全部标签

c# - Lambda\Anonymous 函数作为参数

我是C#的新手。只是玩弄它。并非出于真正目的。voidmakeOutput(int_param){Console.WriteLine(_param.ToString());}//...//Somewhereinacode{makeOutput(/*somenotc#codeforanexampleforwhatdoIwant*/function:int(){return0;});}是否可以使用真正的匿名函数(意味着返回结果)?我不想使用这样的委托(delegate)//Somewhereinacode{Funcx=()=>{return0;};makeOutput(x())}我也不想更