NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

String.CopyTo

Copies a specified number of characters from a specified location in this string to a specified location in an array.

[Visual Basic]
Public Sub CopyTo( _
   ByVal sourceIndex As Integer, _
   ByVal destination() As Char, _
   ByVal destinationIndex As Integer, _
   ByVal count As Integer _
)
[C#]
public void CopyTo(
   int sourceIndex,
   char[] destination,
   int destinationIndex,
   int count
);
[C++]
public: void CopyTo(
   int sourceIndex,
   __wchar_t* destination[],
   int destinationIndex,
   int count
);
[JScript]
public function CopyTo(
   sourceIndex : int,
   destination : Char[],
   destinationIndex : int,
   count : int
);

Parameters

sourceIndex
The index in the string where to start copying.
destination
The array of characters to copy to.
destinationIndex
The index in the destination array where to start copying to.
count
The number of characters to copy.

Exceptions

Exception Type Condition
ArgumentNullException If the destination is null.
ArgumentOutOfRangeException If soureIndex is not a valid index in this string.
ArgumentOutOfRangeException If count and soureIndex is not a valid index in this string.
ArgumentOutOfRangeException If destinationIndex is not a valid index in the array.
ArgumentOutOfRangeException If count and destinationIndex is not a valid index in the array.
IndexOutOfRangeException If the destination is not within the array.

Remarks

The CopyTo method determines the length of the string to be copied (sourceIndex plus the count), determines where to start coping the string (sourceIndex) from a specified location in this string, and copies the selected string to a specified location in an array (destinationIndex).

Only count characters are copied.

See Also

String Class | String Members | System Namespace | Char | Int32