StringBuilder.Append Vs StringBuilder.AppendFormat

前端 未结 9 1345
轮回少年
轮回少年 2021-01-31 15:30

I was wondering about StringBuilder and I\'ve got a question that I was hoping the community would be able to explain.

Let\'s just forget about code readability, which o

9条回答
  •  难免孤独
    2021-01-31 16:24

    Faster is 1 in your case however it isn't a fair comparison. You should ask StringBuilder.AppendFormat() vs StringBuilder.Append(string.Format()) - where the first one is faster due to internal working with char array.

    Your second option is more readable though.

提交回复
热议问题