Is there any advantage of using System.String over String.Builder
-
It is immutable
-
Simplifies strng manipulations
-
Simplifies concurrent multithreaded programming
-
None of the above
System.String is immutable, which makes it inherently thread-safe. Multiple threads can access and read the same String object simultaneously without locks or synchronization, unlike StringBuilder which requires explicit coordination in multithreaded environments.
Because System.String is immutable, its value can never change after creation, so multiple threads can read the same String instance concurrently without any risk of one thread corrupting it for another. This removes the need for locks or synchronization that a mutable type like StringBuilder would require in a multithreaded context, which is why 'simplifies concurrent multithreaded programming' is the advantage being tested here.