Can a C# lambda expression have more than one statement?

后端 未结 8 1211
花落未央
花落未央 2020-11-29 03:37

Can a C# lambda expression include more than one statement?

(Edit: As referenced in several of the answers below, this question originally asked about \"lines\" rath

8条回答
  •  遥遥无期
    2020-11-29 04:26

    With c# 7.0 You can use like this also

    Public string ParentMethod(int i, int x){
        int calculation = (i*x);
        (string info, int result) InternalTuppleMethod(param1, param2)
        {
            var sum = (calculation + 5);
            return ("The calculation is", sum);
        }
    }
    

提交回复
热议问题