26
1
using System;
2
using System.Linq;
3
using System.Collections.Generic;
4
5
6
public class Program
7
{
8
public static void Main()
9
{
10
IList<string> strList = new List<string>(){ "One", "Two", "Three", "Two", "Three" };
11
12
IList<int> intList = new List<int>(){ 1, 2, 3, 2, 4, 4, 3, 5 };
13
14
var distinctList1 = strList.Distinct();
15
16
foreach(var str in distinctList1)
17
Console.WriteLine(str);
18
19
var distinctList2 = intList.Distinct();
20
21
foreach(var i in distinctList2)
22
Console.WriteLine(i);
23
24
}
25
}
26
Cached Result
>