The Format Item Syntax

  • { index[,alignment][ :formatString] }
  • Escape Brace: To output a { you use {{ and to output a } you use }}.
  • Reference: MSDN Help
string t = "1, 2, 3";
string v = String.Format(" foo {{{0}}}", t);

Syntactic sugar

string t= "1, 2, 3";
string v = $"" foo {{{t}}}"";

相关文章: