Most efficient way to concatenate strings?

后端 未结 17 1277
野趣味
野趣味 2020-11-22 03:04

What\'s the most efficient way to concatenate strings?

17条回答
  •  北海茫月
    2020-11-22 03:36

    It would depend on the code. StringBuilder is more efficient generally, but if you're only concatenating a few strings and doing it all in one line, code optimizations will likely take care of it for you. It's important to think about how the code looks too: for larger sets StringBuilder will make it easier to read, for small ones StringBuilder will just add needless clutter.

提交回复
热议问题