Click here to Skip to main content
15,174,684 members
Articles / Multimedia / GDI
Technical Blog
Posted 25 Nov 2014


9 bookmarked

What’s New in C# 6.0? - String Interpolation

Rate me:
Please Sign up or sign in to vote.
4.77/5 (15 votes)
25 Nov 2014CPOL2 min read
String interpolation in C# 6.0

Image 1Did 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 / string concatenation.

Image 2

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.

Old ways of string concatenation (

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:

Image 4

Hope you liked this feature. Microsoft is still working on this to improve a lot in string interpolation/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


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Kunal Chowdhury «IN»
Technical Lead
India India

Kunal Chowdhury is a former Microsoft "Windows Platform Development" MVP (Most Valuable Professional, 2010 - 2018), a Codeproject Mentor, Speaker in various Microsoft events, Author, passionate Blogger and a Senior Technical Lead by profession.

He is currently working in an MNC located in India. He has a very good skill over XAML, C#, Silverlight, Windows Phone, WPF and Windows app development. He posts his findings, articles, tutorials in his technical blog ( and CodeProject.

Books authored:

Connect with Kunal on:

Comments and Discussions

BugOut of date Pin
Alexander Pacha25-Nov-15 7:33
MemberAlexander Pacha25-Nov-15 7:33 
GeneralRe: Out of date Pin
Kunal Chowdhury «IN»16-Jun-17 3:15
professionalKunal Chowdhury «IN»16-Jun-17 3:15 
GeneralMy vote of 1 Pin
Bitcrazed21-Sep-15 17:00
MemberBitcrazed21-Sep-15 17:00 
PraiseRe: My vote of 1 Pin
Rasik Bihari Tiwari15-Jun-17 20:03
professionalRasik Bihari Tiwari15-Jun-17 20:03 
GeneralRe: My vote of 1 Pin
Kunal Chowdhury «IN»16-Jun-17 1:03
professionalKunal Chowdhury «IN»16-Jun-17 1:03 
GeneralRe: My vote of 1 Pin
Kunal Chowdhury «IN»16-Jun-17 3:15
professionalKunal Chowdhury «IN»16-Jun-17 3:15 
QuestionEscape Sequence changed Pin
V U M Sastry Sagi12-May-15 21:17
MemberV U M Sastry Sagi12-May-15 21:17 
Suggestion'$' präfix for clearer code Pin
stylertyp6-May-15 22:08
Memberstylertyp6-May-15 22:08 
SuggestionNothing more than on MSDN Pin
Klaus Luedenscheidt25-Nov-14 20:02
MemberKlaus Luedenscheidt25-Nov-14 20:02 
AnswerRe: Nothing more than on MSDN Pin
Kunal Chowdhury «IN»26-Nov-14 6:41
professionalKunal Chowdhury «IN»26-Nov-14 6:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.