- array
- The one-dimensional array that is the destination of the items to be copied from the collection. Note: The array must have zero-based indexing.
- arrayIndex
- The zero-based index in the destination array at which copying begins.
Visual Basic (Declaration) | |
---|---|
Public Sub CopyTo( _ ByVal array() As TargetDevice, _ ByVal arrayIndex As Integer _ ) |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As TargetDevices Dim array() As TargetDevice Dim arrayIndex As Integer instance.CopyTo(array, arrayIndex) |
C# | |
---|---|
public void CopyTo( TargetDevice[] array, int arrayIndex ) |
C++/CLI | |
---|---|
public: void CopyTo( array<TargetDevice^>^ array, int arrayIndex ) |
Parameters
- array
- The one-dimensional array that is the destination of the items to be copied from the collection. Note: The array must have zero-based indexing.
- arrayIndex
- The zero-based index in the destination array at which copying begins.
Exception | Description |
---|---|
System.ArgumentNullException | |
System.ArgumentOutOfRangeException | |
System.ArgumentException |
Visual Basic | Copy Code |
---|---|
Public _result As Boolean = False Public _form As ConvertCtrlForm = New ConvertCtrlForm() Public Sub CopyToExample() ' reference the form convert control Dim convertctrl As ConvertCtrl = _form.ConvertCtrl Dim devices As TargetDevices = convertctrl.TargetDevices Try ' allocate a new array for the copied video devices Dim copiedDevices As TargetDevice() = New TargetDevice(devices.Count - 1) {} ' copy them devices.CopyTo(copiedDevices, 0) ' set the result to what we expect _result = (copiedDevices.Length = devices.Count) Catch e1 As Exception _result = False End Try End Sub |
C# | Copy Code |
---|---|
public bool _result = false; public ConvertCtrlForm _form = new ConvertCtrlForm(); public void CopyToExample() { // reference the form convert control ConvertCtrl convertctrl = _form.ConvertCtrl; TargetDevices devices = convertctrl.TargetDevices; try { // allocate a new array for the copied video devices TargetDevice[] copiedDevices = new TargetDevice[devices.Count]; // copy them devices.CopyTo(copiedDevices, 0); // set the result to what we expect _result = (copiedDevices.Length == devices.Count); } catch (Exception) { _result = false; } } |
Copies the items of the collection to a TargetDevice array, starting at a specified array index.
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7