Breyta

Deila með


StringBuilder.MaxCapacity Property

Definition

Gets the maximum capacity of this instance.

public:
 property int MaxCapacity { int get(); };
public int MaxCapacity { get; }
member this.MaxCapacity : int
Public ReadOnly Property MaxCapacity As Integer

Property Value

The maximum number of characters this instance can hold.

Remarks

The maximum capacity for this implementation is Int32.MaxValue. However, this value is implementation-specific and might be different in other or later implementations. You can explicitly set the maximum capacity of a StringBuilder object by calling the StringBuilder(Int32, Int32) constructor.

In .NET Core and in the .NET Framework 4.0 and later versions, when you instantiate the StringBuilder object by calling the StringBuilder(Int32, Int32) constructor, both the length and the capacity of the StringBuilder instance can grow beyond the value of its MaxCapacity property. This can occur particularly when you call the Append(String) and AppendFormat(String, Object) methods to append small strings.

Applies to