Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Sep 4, 2022, 1:52 AM EDT
Alkesh BijarniyaRank #237 · 10.4K reputationPosted Sep 4, 2022, 2:07 AM EDT
Vishal YelveRank #178 · 13.6K reputationPosted Sep 4, 2022, 9:42 AM EDT
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);
Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Nov 11, 2022, 3:23 AM EST
https://www.webopedia.com/definitions/string-interpolation/
Rajeev KumarRank #1,334 · 1.3K reputationPosted Mar 3, 2023, 2:24 AM EST
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);