What is the .NET equivalent of java.lang.StringBuffer
?
NET platforms. Java has its own virtual machine, the Java Virtual Machine (JVM) which is similar to . NET CLR. Java's execution engine (the JVM) and a Java compiler with a set of libraries constitute the Java Platform.
String buffer is mutable classes which can be used to do operation on string object such as reverse of string, concating string and etc. We can modify string without creating new object of the string. String buffer is also thread safe. Also, string concat + operator internally uses StringBuffer or StringBuilder class.
StringBuilder is same as the StringBuffer , that is it stores the object in heap and it can also be modified . The main difference between the StringBuffer and StringBuilder is that StringBuilder is also not thread safe. StringBuilder is fast as it is not thread safe .
It's System.Text.StringBuilder
. Note that in modern Java you'd use java.lang.StringBuilder
too. (It's like StringBuffer
, but without the synchronization - I can't remember the last time I wanted the synchronization of StringBuffer
. Note that the .NET StringBuilder
isn't thread-safe either, but again, I can't remember the last time I found that to be a problem.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With