c# string variable replacement code example
Example 1: c sharp string interpolation
// To use interpolation in strings, put the name of the relevant
// variable between brackets {} and put a dollar sign $ in front
// of the string. This will tell C# to use interpolation.
double a = 3;
double b = 4;
Console.WriteLine($"Area of {a} and {b} is {0.5 * a * b}");
Example 2: c sharp string replace
// You can use the function 'Replace()' to replace all instances
// of a string or character with a given string or character.
str = "Hello World!"
str.Replace('o', 'e');
// Output: "Helle Werld!"
Example 3: f string C#
string name = "John"
Console.WriteLine($"Hello {name}")