Wednesday, July 8, 2009

Whats The Difference Between string and stringbuilder

String

Strings are immutable and they are actually returning a modified copy of the string.

StringBuilder

Strings are mutable there object as a buffer that can contain a string with the ability to grow from zero characters to the buffer's current capacity. Until you exceed that capacity, the string is assembled in the buffer and no object is allocated or released. If the string becomes longer than the current capacity, the StringBuilder object transparently creates a larger buffer. The default buffer initially contains 16 characters

No comments: