Property Capacity
Capacity
The number of bytes this string has for storing UTF-8 characters.
Declaration
public int Capacity { readonly get; set; }
Property Value
Type | Description |
---|---|
int | The number of bytes this string has for storing UTF-8 characters. |
Implements
Remarks
Does not include the null-terminator byte.
A setter is included for conformity with INativeList<T>, but Capacity is fixed at 509. Setting the value to anything other than 509 throws an exception.
In UTF-8 encoding, each Unicode code point (character) requires 1 to 4 bytes, so the number of characters that can be stored may be less than the capacity.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if attempting to set the capacity to anything other than 509. |