System Namespace String Class
Copies a specified number of characters from a specified position in the given String to a specified position in an array of Unicode characters.
[ VB ]
<Serializable>
Public Sub CopyTo ( _
ByVal sourceIndex As Integer, _
ByVal destination ( ) As Char, _
ByVal destinationIndex As Integer, _
ByVal count As Integer _
)
[ C# ]
[ Serializable ]
public void CopyTo (
int sourceIndex,
char [ ] destination,
int destinationIndex,
int count
);
[ C++ ]
[ Serializable ]
public: void CopyTo (
int sourceIndex,
__wchar_t destination __gc [ ],
int destinationIndex,
int count
);
[ JScript ]
public Serializable
function CopyTo (
sourceIndex : int,
destination : Char [ ],
destinationIndex : int,
count : int
);
- sourceIndex
- A character position in the given String.
- destination
- An array of Unicode characters.
- destinationIndex
- An array element in destination.
- count
- The number of characters in the given String to copy to destination.
Exception Type |
Condition |
ArgumentNullException |
destination is a null reference ( Nothing in Visual Basic ). |
ArgumentOutOfRangeException |
sourceIndex, destinationIndex, or count is negative
-or-
count is greater than the length of the substring from startIndex to the end of this instance
-or-
count is greater than the length of the subarray from destinationIndex to the end of destination
|
count characters are copied from the sourceIndex position of this instance to the destinationIndex position of destination.
sourceIndex and destinationIndex are zero-based.
String Members Char Int32 Insert Substring