System.Text.RegularExpressions.MatchCollection.CopyTo Method

Copies all the elements of the collection to the given array starting at the given index.

Syntax

public void CopyTo (Array array, int arrayIndex)

Parameters

array
The array the collection is to be copied into.
arrayIndex
The position in the array where copying is to begin.

Remarks

Because the collection is copied into the array starting at the given index, the destination array must be at least as large as the entire collection.

Note:

This member is not present in the net_portable. If you are developing applications that target the net_portable, use the CaptureCollection.System#Collections#ICollection#CopyTo(Array, int) method instead.

Because the System.Text.RegularExpressions.MatchCollection object is generally populated by using lazy evaluation, trying to copy the collection before it has been fully populated may throw a System.Text.RegularExpressions.RegexMatchTimeoutException exception. This exception can be thrown if a time-out value for matching operations is in effect, and the attempt to find a single match exceeds that time-out interval.

Requirements

Namespace: System.Text.RegularExpressions
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0