System Namespace String Class
Copies the characters in a specified substring in the given String to a Unicode character array.
[ VB ]
<Serializable>
Overloads Public Function ToCharArray ( _
ByVal startIndex As Integer, _
ByVal length As Integer _
) As Char ( )
[ C# ]
[ Serializable ]
public char [ ] ToCharArray (
int startIndex,
int length
);
[ C++ ]
[ Serializable ]
public: __wchar_t ToCharArray (
int startIndex,
int length
) __gc [ ];
[ JScript ]
public Serializable
function ToCharArray (
startIndex : int,
length : int
) : Char [ ];
- startIndex
- The starting position of a substring in the given String.
- length
- The length of the substring in the given String.
A Unicode character array whose elements are the length number of characters in the given String starting from character position startIndex.
Exception Type |
Condition |
ArgumentOutOfRangeException |
startIndex or length is less than zero.
-or-
startIndex plus length is greater than the length of this instance.
|
If length is zero, the entire string is copied starting from the beginning of this instance, and ignoring the value of startIndex. If this instance is an empty string, the returned array is empty and has a zero length.
String Members String.ToCharArray Overload List Array Char Int32