Is StringBuilder thread safe

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

Is StringBuilder thread safe? This thought occurred to me as I was
thinking of the reasons they made Strings immutable: thread safety.
 
If you look in the MSDN help on StringBuilder (or any class for that
matter), you will see a link about its thread safety.
 
okay, I should have checked the docs more carefully. So essentially
you're on your own with StringBuilder. That's what I thought.

From the docs for StringBuilder class:
http://msdn.microsoft.com/library/d...ml/frlrfsystemtextstringbuilderclasstopic.asp

Thread Safety
Any public static (Shared in Visual Basic) members of this type are
thread safe. Any instance members are not guaranteed to be thread safe.

From the docs for String class:
http://msdn.microsoft.com/library/d...ef/html/frlrfsystemstringclassequalstopic.asp

Thread Safety
This type is safe for multithreaded operations.
 
Back
Top