Distinct - 1

Query
public void Linq46()
{
int[] factorsOf300 = { 2, 2, 3, 5, 5 };

var uniqueFactors = factorsOf300.Distinct();

Console.WriteLine("Prime factors of 300:");
foreach (var f in uniqueFactors)
{
Console.WriteLine(f);
}
}
Lambda Expression
public void Linq46()
{
int[] factorsOf300 = { 2, 2, 3, 5, 5 };

var uniqueFactors = factorsOf300.Distinct();

Console.WriteLine("Prime factors of 300:");
foreach (var f in uniqueFactors)
{
Console.WriteLine(f);
}
}
Output
Prime factors of 300:
2
3
5
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 # # # # #