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

后端 未结 8 1215
花落未央
花落未央 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:22

    From Lambda Expressions (C# Programming Guide):

    The body of a statement lambda can consist of any number of statements; however, in practice there are typically no more than two or three.

提交回复
热议问题