Copy a number of elements from SortedSet to an array, starting at the specified array index in CSharp
Description
The following code shows how to copy a number of elements from SortedSet to an array, starting at the specified array index.
Example
using System;/*from w w w. java 2 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);
foreach(int i in intArray){
Console.WriteLine(i);
}
}
}
The code above generates the following result.