String output: format or concat in C#?

前端 未结 30 1613
一生所求
一生所求 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:00

    Pity the poor translators

    If you know your application will stay in English, then fine, save the clock ticks. However, many cultures would usually see Lastname Firstname in, for instance, addresses.

    So use string.Format(), especially if you're going to ever have your application go anywhere that English is not the first language.

提交回复
热议问题