String.Format Method

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}}}"";

猜你喜欢

转载自www.cnblogs.com/dalianliyan/p/6728357.html
今日推荐