variable inside string C# code example
Example 1: c# write variable in string
int age = 22;
Console.WriteLine($"Age: {age}");
Example 2: C# using variables inside strings
string name = "John";
string result = $"Hello {name}";
int age = 22;
Console.WriteLine($"Age: {age}");
string name = "John";
string result = $"Hello {name}";