String output: format or concat in C#?

前端 未结 30 1930
一生所求
一生所求 2020-11-22 11:40

Let\'s say that you want to output or concat strings. Which of the following styles do you prefer?

  • var p = new { FirstName = \"Bill\", LastName = \"Ga

30条回答
  •  独厮守ぢ
    2020-11-22 12:01

    Oh, and just for completeness, the following is a few ticks faster than normal concatenation:

    Console.WriteLine(String.Concat(p.FirstName," ",p.LastName));
    

提交回复
热议问题