Did you download the new Visual Studio 2015 IDE? If not, try the preview version before it actually releases and start improving your coding skills with the forthcoming IDE from Microsoft. Today, we are going to explore another new feature of C# 6.0 coming with this release.
Let’s continue the series “What’s new in C# 6.0?” and show you what’s coming with C# 6.0 in terms of
string interpolation /
Don’t forget to read my previous post on this series: “What’s new in C# 6.0? - Setting default values to Auto Properties”.
String concatenation – we regularly use it to show different records to the user. To do this, we either use the ‘+’ symbol or the
string.Format method to format and organize various
strings. This now becomes old days mechanism.
In C# 6.0, Microsoft added new feature to accelerate your coding skill. Now you can put expressions directly in the
string literal to show the values in a proper formatted manner. You can also easily align or specify different format to your values. Not only this! You can now write conditions within
string literals with additional
strings as content.
Here are a few examples of what we can do now with C# 6.0 in Visual Studio 2015 and .NET 4.6:
Hope you liked this feature. Microsoft is still working on this to improve a lot in
string concatenation to add more a easier way to provide conditions in
strings. Wish to see them soon in the coming release of Visual Studio 2015.
It’s not the end. More to come in this series. Stay tuned to my blog for updates. Till that time, enjoy reading my other posts. Why don’t you subscribe to my blog’s RSS Feed and Email Newsletter? This will give you immediate update in your inbox. Connect with me over Twitter, Facebook and Google+ to get the updates which I share.
You may like to follow me on twitter @kunal2383 or may like the Facebook page of my blog http://www.facebook.com/blog.kunal.