Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the .NET equivalent of StringBuffer in Java?

Tags:

java

string

c#

.net

What is the .NET equivalent of java.lang.StringBuffer?

like image 696
The Internet Avatar asked Aug 15 '12 21:08

The Internet


People also ask

What is .NET equivalent in Java?

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.

What is StringBuffer class in C#?

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.

What is StringBuffer and StringBuilder in C#?

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 .


1 Answers

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.)

like image 69
Jon Skeet Avatar answered Sep 22 '22 10:09

Jon Skeet