First let's see the code example upfront, to give readers the feeling of topic that we are going to cover in this post.
Func<string, int> func = delegate(string text) { return text.Length; }; // | // | Conver to lambda expression // V func = (string text) => { return text.Length; }; // | // | Single-expression no braces is requried. // V func = (string text) => text.Length; // | // | Let hte compiler infer the paramter type // V func = (text) => text.Length; // | // | Remove the unnecessary parentheses // V func = text => text.Length;
So, basically this gives up the chart that we can use as a reference when we are refine some delegate expression to lambda expresison (to be more precise, concise lambda expression actually)
You may start towards writing the most concise expresion, but it does good to know how distilled from the dalegate to the lambda expression.