Lambda Expressions as Shorthand for Delegate Initialization
suggest changepublic delegate int ModifyInt(int input);
ModifyInt multiplyByTwo = x => x * 2;
The above Lambda expression syntax is equivalent to the following verbose code:
public delegate int ModifyInt(int input);
ModifyInt multiplyByTwo = delegate(int x){
return x * 2;
};
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents