Share via


Length Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets the length of the current StringBuilder object.

Namespace:  System.Text
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Property Length As Integer
public int Length { get; set; }
public:
property int Length {
    int get ();
    void set (int value);
}
member Length : int with get, set
function get Length () : int
function set Length (value : int)

Property Value

Type: System. . :: . .Int32
The length of this instance.

Remarks

Like the String..::..Length property, the Length property indicates the length of the current string object. Unlike the String..::..Length property, which is read-only, the Length property allows you to modify the length of the string stored to the StringBuilder object.

If the specified length is less than the current length, the current StringBuilder object is truncated to the specified length. If the specified length is greater than the current length, the end of the string value of the current StringBuilder object is padded with the Unicode NULL character (U+0000).

If the specified length is greater than the current capacity, Capacity increases so that it is greater than or equal to the specified length.

.NET Framework Security

See Also

Reference

StringBuilder Class

System.Text Namespace