Before I start this post, I will like to tell that the pre-requisites to this article is Visual Studio 2015 and C# 6.0 Edition.
C# 6.0 brings some new super powers to the table and I am going to cover this features in a series of post.
In today’s post I will focus on some new ways of writing things which makes code readability and usage a lot easier.
It basically gives CRM developers new Superpowers:
1. Ability to declare types as Static( In the example below, I have declared System.Math as static with using clause,
this gives freedom to directly call the types in the code without needing to use full types.
For eg. Using Math.Sqrt is not required anymore. Sqrt is enough:
2. Replacement to String.Format with $:
String. Format can be replaced by $ statements, making code cleaner to read:
3. Lambada style function declarations:
C# 6.0 now allows for lambada style function declarations, For eg:
The full code using the above features looks lot cleaner:
Hope it helps and Happy C# 6.0, VS 2015 experience and Happy CRMing!