how to insert a variable into a string c# code example
Example 1: insert variables into string c#
string data = "Mr. Rogers";
var str = $"Hello {data}, how are you doing?";
Example 2: insert variables into a string C#
// For Console.WriteLine() and Console.Write() do...
string var0 = "one";
string var1 = "two";
Console.WriteLine("{0} and {1}", var0, var1);
/* Outputs:
one and two