Sunday, 4 October 2015

C# 6.0 - String Interpolation Part 1

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.
Old ways of string concatenation (www.kunal-chowdhury.com)
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 few examples of what we can do now with C# 6.0 in Visual Studio 2015 and .NET 4.6:
What's new in C# 6.0 - String Interpolation (www.kunal-chowdhury.com)
Hope you liked this feature. Microsoft is still working on this to improve a lot in string interpolation/string concatenation to add more 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 on 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.

No comments:

Post a Comment