Share via


TaskListCollection.CopyTo(TaskList[], Int32) Method

Definition

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

public:
 void CopyTo(cli::array <Microsoft::Web::Management::Client::TaskList ^> ^ taskLists, int index);
public void CopyTo (Microsoft.Web.Management.Client.TaskList[] taskLists, int index);
member this.CopyTo : Microsoft.Web.Management.Client.TaskList[] * int -> unit
Public Sub CopyTo (taskLists As TaskList(), index As Integer)

Parameters

taskLists
TaskList[]

The one-dimensional TaskList array that is the destination of the elements copied from the TaskListCollection object.

index
Int32

The zero-based index in taskLists at which copying begins.

Examples

The following example copies the TaskListCollection elements to a local TaskList array. It then writes the contents of the task list collection to the trace listener.

public void tCopyTo() {

    // Create a initialized collection
    TaskListCollection tlc = Tasks;

    TaskList[] tl = new TaskList[tlc.Count];

    tlc.CopyTo(tl, 0);

    for (int i = 0; i < tl.GetLength(0); i++)
        Trace.WriteLine(tl[i].ToString() + " ");
}

Remarks

The taskLists array must have zero-based indexing.

Applies to