{C# 6.0 and VS 2015 Quick Tip} Coding Superpowers for CRM developers – Part 1

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:

clip_image001

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:

clip_image002

clip_image003

2. Replacement to String.Format with $:

String. Format can be replaced by $ statements, making code cleaner to read:

clip_image004

3. Lambada style function declarations:

C# 6.0 now allows for lambada style function declarations, For eg:

clip_image005

The full code using the above features looks lot cleaner:

clip_image006

clip_image007

Hope it helps and Happy C# 6.0, VS 2015 experience and Happy CRMing!

Advertisements

3 thoughts on “{C# 6.0 and VS 2015 Quick Tip} Coding Superpowers for CRM developers – Part 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s