Put Multiple Statements in a Statement Lambda

suggest change

Unlike an expression lambda, a statement lambda can contain multiple statements separated by semicolons.

delegate void ModifyInt(int input);

ModifyInt addOneAndTellMe = x =>
    int result = x + 1;

Note that the statements are enclosed in braces {}.

Remember that statement lambdas cannot be used to create expression trees.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents