Thursday, 7 July 2016

What are differences between system.stringbuilder and system.string?

1. The main difference is system.string is immutable and system.stringbuilder is a mutable. Append keyword is used in string builder but not in system.string.

2. Immutable means once we created we cannot modified. Suppose if we want give new value to old value simply it will discarded the old value and it will create new instance in memory to hold the new value.


What is an immutable object?
In object-oriented and functional programming, an immutable object is an objectwhose state cannot be modified after it is created. This is in contrast to a mutableobject, which can be modified after it is created
Appends a copy of the specified string to this instance.
public StringBuilder Append(
 string value
)

No comments:

Post a Comment