DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Distinct Using LINQ

05.06.2012
| 2300 views |
  • submit to reddit
        
 int[] numberList = { 2, 2, 3,3,3, 4, 4 }; 
  
    var distinctNumbers = numberList.Distinct(); 
  
    foreach (var f in distinctNumbers) 
    { 
        Console.WriteLine(f); 
    }