Copy SortedSet to an array, starting at the specified array index in CSharp
Description
The following code shows how to copy SortedSet to an array, starting at the specified array index.
Example
using System;/* ww w . j a v a2s . 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[10];
evenNumbers.CopyTo(intArray, 0);
foreach(int i in intArray){
Console.WriteLine(i);
}
}
}
The code above generates the following result.