C# HashSet HashSet()
Description
HashSet
initializes
a new instance of the HashSet
Syntax
public HashSet(
collection
)
Parameters
collection
- The collection whose elements are copied to the new set.
Example
//from w ww. ja va 2 s . co m
using System;
using System.Collections.Generic;
public class MainClass{
public static void Main(String[] argv){
HashSet<int> evenNumbers = new HashSet<int>();
for (int i = 0; i < 5; i++)
{
evenNumbers.Add(i * 2);
}
}
}