Explanation - Int array:
- int[] num = new int[] { 2, 3, 4, 5, 6, 7, 5, 3, 1, 7, 9, 8, 5, 4 };
- var x = from a in num
- group a by a into g
- where g.Count()==1
- select g;
- foreach (var item in x)
- {
- Console.WriteLine(item.Key);
- }
Output:
2
6
1
9
8
Explanation - Char array:
- string str = "thisistestinfile";
- var x = from a in str
- group a by a into g
- where g.Count() == 1
- select g;
- foreach (var item in x)
- {
- Console.WriteLine(item.Key);
- }
output:
h
n
f
l