In the new C # 6.0, we can define methods and properties using lambda expressions.
No, you canβt. You can define the bodies of methods and properties using syntax that looks like a lambda expression because it uses the token => .
However, importantly, this does not mean that there is a delegate type. (Whereas a lambda expression is only allowed in the context where it is converted to an expression tree or delegate type.)
This is pure syntactic sugar. Your two code snippets will be compiled with the same IL. This is just another way of representing the body of a getter or method.
Jon Skeet Feb 09 '15 at 13:58 2015-02-09 13:58
source share