What is string interpolation?
Loading
What is string interpolation?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajanikant HawaldarPosted Sep 4, 2022, 5:52 AM
Rajeev KumarPosted Mar 3, 2023, 7:24 AM
interpolation is a method of concatenating, formatting, and manipulating strings. This feature was introduced in C# 6. Using string interpolation, we can use objects and expressions as a part of the string interpolation operation.
string Name= "Arun Tiwari";
string hello = $"Hello {Name} !";
Console.WriteLine(hello);
Brahma Prakash ShuklaPosted Nov 11, 2022, 8:23 AM
https://www.webopedia.com/definitions/string-interpolation/
Vishal YelvePosted Sep 4, 2022, 1:42 PM
C# string interpolation allows us to insert variables into the string. It uses simple syntax and looks like a template. An interpolated string returns a string as a result.
Syntax:
$" { [,] [<:format-string>] } ..."
Example:
var s1 = $"{name} is {age} years old."; Console.WriteLine(s1);
Alkesh BijarniyaPosted Sep 4, 2022, 6:07 AM