1.string.Format()占位符的替换

  使用$"{*}"和string.Format("{0}",*)的效果完全一样。

static void Main(string[] args)
{
    string name = "dp"; int age = 24;
    string console = $"Hello,{name},Your Age Is {age}";
    string console1 = string.Format("Hello,{0},Your Age Is {1}", name, age);
    Console.WriteLine(console);
    Console.WriteLine(console);

    Console.Read();
}

 

相关文章:

  • 2021-12-04
  • 2021-10-29
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
猜你喜欢
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2021-06-26
  • 2022-12-23
相关资源
相似解决方案