This documentation is archived and is not being maintained.

StringBuilder Constructor (String, Int32, Int32, Int32)

.NET Framework 1.1

Initializes a new instance of the StringBuilder class from the specified substring and capacity.

[Visual Basic]
Public Sub New( _
   ByVal value As String, _
   ByVal startIndex As Integer, _
   ByVal length As Integer, _
   ByVal capacity As Integer _
)
[C#]
public StringBuilder(
   string value,
 int startIndex,
 int length,
 int capacity
);
[C++]
public: StringBuilder(
   String* value,
 int startIndex,
 int length,
 int capacity
);
[JScript]
public function StringBuilder(
   value : String,
 startIndex : int,
 length : int,
 capacity : int
);

Parameters

value
The string that contains the substring used to initialize the value of the instance. If value is a null reference (Nothing in Visual Basic), the new StringBuilder will contain the empty string (that is, it contains Empty).
startIndex
The position where the substring begins.
length
The number of characters in the substring.
capacity
The suggested starting size of the StringBuilder.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException capacity is less than zero.

-or-

startIndex plus length is not a position within value.

Remarks

If capacity is zero, the implementation-specific default capacity is used.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

StringBuilder Class | StringBuilder Members | System.Text Namespace | StringBuilder Constructor Overload List

Show: