interpolation string code example
Example 1: c sharp string interpolation
double a = 3;
double b = 4;
Console.WriteLine($"Area of {a} and {b} is {0.5 * a * b}");
Example 2: f string C#
string name = "John"
Console.WriteLine($"Hello {name}")
Example 3: string interpolation
let a = 5;
let b = 10;
console.log('Fifteen is ' + (a + b) + ' and\nnot ' + (2 * a + b) + '.');
let a = 5;
let b = 10;
console.log(`Fifteen is ${a + b} and
not ${2 * a + b}.`);
Example 4: string interpolation
const number = 42;
const message = `The number is ${number}`;
message;