DB2ParameterCollection.CopyTo Method

Copies DB2Parameter objects from the DB2ParameterCollection to the specified array.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


[Visual Basic]
NotOverridable Public Sub CopyTo( _
   ByVal array As Array, _
   ByVal index As Integer _
) Implements ICollection.CopyTo
[C#]
public void CopyTo(
   Array array,
   int index
);
[C++]
public: __sealed void CopyTo(
   Array* array,
   int index
);
[JScript]
public function CopyTo(
   array : Array,
   index : int
);
Implements:
ICollection.CopyTo

Parameters

array
The target array into which to copy the DB2®Parameter objects.
index
The starting index of the target array.

Example

[Visual Basic, C#] The following example exports the DB2ParameterCollection to an array of DB2Parameter objects, doubles the size of the array by using CopyTo and returns the collection. It then clears the collection, and returns true if the parameters are no longer persisting. This example assumes that a DB2ParameterCollection has already been created.

[Visual Basic]
Public Function DoubleYourParams() As Boolean
    ' ...
    ' create DB2ParameterCollection myParameters
    ' ...
    Dim myParamArray(2 * myParameters.Count - 1) As DB2Parameter
    myParameters.CopyTo(myParamArray, 0)
    myParameters.CopyTo(myParamArray, myParameters.Count)
    myParameters.Clear()
    Return True
End Function 'DoubleYourParams

[C#]
public bool DoubleYourParams() {
    // ...
    // create DB2ParameterCollection myParameters
    // ...
    DB2Parameter[] myParamArray = new DB2Parameter[(2*myParameters.Count) - 1];
    myParameters.CopyTo(myParamArray, 0);
    myParameters.CopyTo(myParamArray, myParameters.Count);
    myParameters.Clear();
    return true;
 }