I love people and everything good. And I want to positively influence people and be influenced by positive people. I am in love with software development using .NET Technologies.
This expression bodied syntax in C# is only available if the method is a single statement. Once you go beyond a single statement, you have to use curly braces and return. It’s a handy shortcut when you can use it, but it is not the typical C# experience. The F# code could be shorter as well: let add = (+)
However, the example in the article is demonstrating the structure that you will usually see in each language, not the shortest possible representation of that specific code.
I love people and everything good. And I want to positively influence people and be influenced by positive people. I am in love with software development using .NET Technologies.
int Add(int a, int b) => a + b;
This expression bodied syntax in C# is only available if the method is a single statement. Once you go beyond a single statement, you have to use curly braces and
return
. It’s a handy shortcut when you can use it, but it is not the typical C# experience. The F# code could be shorter as well:let add = (+)
However, the example in the article is demonstrating the structure that you will usually see in each language, not the shortest possible representation of that specific code.
Okay.