Represents a mutable string of characters.
This class represents string-like objects that are mutable. After a StringBuilder object has been created, it can be directly modified by removing, replacing, or inserting characters. This contrasts the String class, which represents an immutable string of characters.The System.Text.StringBuilder.Capacity of an instance of the StringBuilder class is the maximum number of characters it can hold in the currently allocated space. The StringBuilder will dynamically allocate more space when it is required.
Unlike most types in the Base Class Library, the arguments to StringBuilder members are assumed to be passed as in / out arguments (passed by reference). [Note: Normally arguments are in arguments (passed by value) unless explicitly declared as out or in / out .]
[Note: An instance of String is said to be "immutable" because its value cannot be modified once it has been created. Methods on String that appear to modify a String instance actually return a new instance containing the modification. The StringBuilder class provides methods that actually modify the contents of a string-like object.
Relational operators only perform reference comparisons (unless overloaded by a particular language compiler). Despite this restriction, relational operators can be used to compare String objects that are assigned literal values. Their values are immutable and can't change, so a reference comparison is sufficient. Because StringBuilder instances are mutable, they should not be compared with relational operators.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment