C# Language Lambda Expressions with Multiple Parameters or No Parameters


Example

Use parentheses around the expression to the left of the => operator to indicate multiple parameters.

delegate int ModifyInt(int input1, int input2);
ModifyInt multiplyTwoInts = (x,y) => x * y;

Similarly, an empty set of parentheses indicates that the function does not accept parameters.

delegate string ReturnString();
ReturnString getGreeting = () => "Hello world.";