C# : String Vs String Builder : Part 25
| String | String Builder | 
|---|---|
| string UserString = "C#" | StringBuilder UserString = new StringBuilder("C#") | 
| UserString+="video"; | UserString.append("video"); | 
| UserString+="tutorial"; | UserString.append("tutorial"); | 
| UserString+="for"; | UserString.append("for"); | 
| UserString+="begineers"; | UserString.append("begineers"); | 
- In this when every time a string is appended a new object is created in new memory location and the previous object remains as it is.
 
- In this when the string is appended, no new memory location is created, the changes take place in same memory location.
 

No comments