When do you use StringBuilder.AppendLine/string.Format vs. StringBuilder.AppendFormat?

前端 未结 7 712
半阙折子戏
半阙折子戏 2021-01-31 13:34

A recent question came up about using String.Format(). Part of my answer included a suggestion to use StringBuilder.AppendLine(string.Format(...)). Jon Skeet suggested this was

7条回答
  •  情歌与酒
    2021-01-31 14:21

    Is it just positively awful to simply use

    sbuilder.AppendFormat("{0} line\n", first);
    

    ? I mean, I know it's not platform-independent or whatever, but in 9 out of 10 cases it gets the job done.

提交回复
热议问题