A good way to concatenate strings in a loop or when performing multiple concatenations, is to use the StringBuilder class:

1An Efficient Method of String ConcatenationString s = "a"
2An Efficient Method of String Concatenations+="b"//this is slow
3An Efficient Method of String Concatenation
4An Efficient Method of String ConcatenationStringBuilder sb = new StringBuilder();
5An Efficient Method of String Concatenationsb.Append("a");
6An Efficient Method of String Concatenationsb.Append("b");

From DevX

相关文章:

  • 2022-12-23
  • 2021-09-02
  • 2021-09-16
猜你喜欢
  • 2021-06-20
  • 2022-12-23
  • 2021-07-07
  • 2021-09-17
  • 2021-05-13
  • 2022-12-23
  • 2021-09-03
相关资源
相似解决方案