rksoftware

Visual Studio とか C# とかが好きです

定数の補間文字列

■ C# 10.0 での新機能

・定数の補間文字列 (Constant interpolated strings)
  https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/constant_interpolated_strings
 const string の定義で値に文字列補間が使えるようになった。

public class C
{
    const string S1 = $"Hello world";
    const string S2 = $"Hello{" "}World";
    const string S3 = $"{S1} Kevin, welcome to the team!";
}