DTSReadOnlyCollectionBase.CopyTo Method

Copies the entire DTSReadOnlyCollectionBase to a compatible one-dimensional array, starting at the specified index of the target array.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)


Public Sub CopyTo ( _
    array As Array, _
    index As Integer _
Dim instance As DTSReadOnlyCollectionBase
Dim array As Array
Dim index As Integer

instance.CopyTo(array, index)
public void CopyTo(
    Array array,
    int index
virtual void CopyTo(
    Array^ array, 
    int index
) sealed
abstract CopyTo : 
        array:Array * 
        index:int -> unit 
override CopyTo : 
        array:Array * 
        index:int -> unit 
public final function CopyTo(
    array : Array, 
    index : int


  • index
    Type: System.Int32
    The zero-based index in the array at which copying begins.


ICollection.CopyTo(Array, Int32)


The following code example is shows the Variables collection, which inherits from DTSReadOnlyCollectionBase, use a previously created package that contains variables to copy the variables into a new array using the CopyTo method.

Variable[] store = new Variable[pkg1.Variables.Count];
pkg1.Variables.CopyTo (store, 0);
Dim store() As Variable =  New Variable(pkg1.Variables.Count) {} 
pkg1.Variables.CopyTo (store, 0)