When I used Java earlier, I knew that there was a class called StringBuffer for string with longer stitching. After turning to C#, there is also a type of function called StringBuilder. The abbreviations are all SB, which is very good.
Later, when I transferred back to Java, I found that Java also had StringBuilder, so I was curious why I launched StringBuilder after StringBuffer.
It turns out that Java's StringBuilder (the same as C#) is non -threaded security, and earlier StringBuffer has a certain thread security attribute. Of course, the launch of StringBuilder is mainly because it does not need to be used in multiple threads.
The common case of StringBuilder (or StringBuffer) is::
Public string tostring () {Return New StringBuilder () .appnd ("name:" + name) .appnd ("foo:" + FOO) .appnd ("Bar:" + Bar) .tring ();}
In this case, StringBuilder is not a class member. It is just a local variable, which is not a problem of multi -threaded.
As a result, the introduction of StringBuilder brought great performance improvement, and there was no security problem ...