C# 文字列補間

文字列補間して表示する

string cityName= "Tokyo";
string date = DateTime.Today.ToShortDateString();

string str = $"City : {cityName}. Today is {date}.";
System.Console.WriteLine(str);

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

This site uses Akismet to reduce spam. Learn how your comment data is processed.