Check out example codes for "c# viariable in string". It will help you in understanding the concepts better.

Code Example 1

string name = "Mark";
var date = DateTime.Now;

// Composite formatting:
Console.WriteLine("Hello, {0}! Today is {1}, it's {2:HH:mm} now.", name, date.DayOfWeek, date);
// String interpolation:
Console.WriteLine($"Hello, {name}! Today is {date.DayOfWeek}, it's {date:HH:mm} now.");
// Both calls produce the same output that is similar to:
// Hello, Mark! Today is Wednesday, it's 19:40 now.

Code Example 2

int age = 22;

Console.WriteLine($"Age: {age}");

Learn ReactJs, React Native from