C# SortedSet CopyTo(T[], Int32, Int32)
Description
SortedSet
copies
a specified number of elements from SortedSet
Syntax
SortedSet.CopyTo(T[], Int32, Int32)
has the following syntax.
public void CopyTo(
T[] array,//from w w w . j a v a 2 s . co m
int index,
int count
)
Parameters
SortedSet.CopyTo(T[], Int32, Int32)
has the following parameters.
array
- A one-dimensional array that is the destination of the elements copied from the SortedSet. The array must have zero-based indexing. index
- The zero-based index in array at which copying begins.count
- The number of elements to copy.
Example
using System;/*from ww w . ja v a2 s . c o m*/
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, 0, 2);
}
}