C# SortedSet CopyTo(T[])

Description

SortedSet CopyTo(T[]) copies the complete SortedSet to a compatible one-dimensional array, starting at the beginning of the target array.

Syntax

SortedSet.CopyTo(T[]) has the following syntax.


public void CopyTo(
  T[] array
)

Parameters

SortedSet.CopyTo(T[]) has the following parameters.

  • array - A one-dimensional array that is the destination of the elements copied from the SortedSet .

Returns

SortedSet.CopyTo(T[]) method returns

Example


/*from w w  w.j  a va 2s  .c om*/
using System;

using System.Collections.Generic;


public class MainClass
{
    public static void Main(String[] argv)
    {
        SortedSet<int> evenNumbers = new SortedSet<int>();
        for (int i = 0; i < 5; i++)
        {
            evenNumbers.Add(i * 2);
        }
        int[] intArray = new int[5];
        evenNumbers.CopyTo(intArray);

    }
}




















Home »
  C# Tutorial »
    System.Collections.Generic »




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack