Showing posts from April, 2017

C# Interpolated Strings

String interpolation. This feature inserts values into a string with simple syntax and it is very useful. It is very much like string.Format, but variables may be accessed directly. Its performance is also similar to string.Format calls.

Below is an example of the string interpolation syntax. See that it always starts with a "$" sign.

int string1 = 100; int string2 = 2; string animals = $"First string = {string1} and Second string = {string2}";