C# Language Put Multiple Statements in a Statement Lambda


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.