Hola!
After String Interpolation and nameof now is time to write about a new cool feature in C#6: Expression Bodied Members. The Main purpose of this feature is to make the code more clean. If you are familiar with Lambda expressions, this feature is similar.
Let’s move to a sample with a Console app, with an operation GetName() to process some strings. C#5 mode will be similar to this:
In C#6 with the new Features, and Visual Studio 2015, the source code for GetName2() will implement an expression bodied members.
As always, if the code will be cleaner … Thanks !!!
References
– El Bruno, String Interpolation https://elbruno.com/2015/04/20/vs2015-string-interpolation-vs-string-format-your-team-will-love-you/
– El Bruno, nameof https://elbruno.com/2015/07/29/vs2015-c-6-nameof-operator-to-get-variables-types-or-members-names/
– MSDN Magazine, the new and improved C#6 https://msdn.microsoft.com/en-us/magazine/dn802602.aspx
Saludos @ Madrid
/El Bruno


Leave a comment