string interpolation and verbatim string literal in C#
string message = $@"
{NameTxt.Text}
{TypeTxt.Text}
{WeightNum.Value}
{KcalPer100g.Value}
{PricePer100g.Value}";
The $ is the string interpolation is to access variables, controls...etc inside brackets{ } in the string
The @ is the verbatim string literal to format your text like you want, so cleaner.
Compare it with the string above, and you can see that it's alot simpler and cleaner with the same result
🥷🥷🥷
2
1 comment
Jessy Girard
5
string interpolation and verbatim string literal in C#
Data Alchemy
skool.com/data-alchemy
Your Community to Master the Fundamentals of Working with Data and AI — by Datalumina®
Leaderboard (30-day)
powered by