System.Text Namespace StringBuilder Class
Sets or retrieves the maximum number of characters that can be contained in the memory allocated by the current instance.
[ VB ] <Serializable> Public Property Capacity As Integer [ C# ] [Serializable] public int Capacity {get; set;} [ C++ ] [Serializable] public: __property int get_Capacity ( ); public: __property void set_Capacity ( int ); [ JScript ] public Serializable function get Capacity ( ) : int; public function set Capacity ( int );
The maximum number of characters that can be contained in the memory allocated by the current instance.
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | Capacity is less than the current length of this instance.
-or- Capacity is greater than the maximum capacity. |
Capacity does not affect the string value of the current instance. Capacity can be decreased as long as it is not less than Length.
The StringBuilder dynamically allocates more space when required and increases Capacity accordingly. For performance reasons, a StringBuilder might allocate more memory than needed. The amount of memory allocated is implementation-specific.
Check out related books at Amazon
© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note