34
1
using System;
2
using System.Collections.Generic;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
9
HashSet<int> EmployeeIds = new HashSet<int>();
10
11
// Add numbers to HashSet object 'EmployeeIds'
12
EmployeeIds.Add(11);
13
EmployeeIds.Add(12);
14
EmployeeIds.Add(13);
15
16
// Add again 11 to EmployeeIds
17
EmployeeIds.Add(11);
18
19
Console.WriteLine("Total count of the EmployeeIds= " + EmployeeIds.Count);
20
foreach (int i in EmployeeIds)
21
{
22
Console.WriteLine(i);
23
}
24
25
Console.WriteLine();
26
27
int[] myIntArray = new int[4] { 11, 12, 13, 11 };
28
Console.WriteLine("Total length of the myIntArray= " + myIntArray.Length);
29
foreach (int i in myIntArray)
30
{
31
Console.WriteLine(i);
32
}
33
}
34
}
Cached Result