stuart-d2
6/1/2015 - 9:33 PM

List - No Duplicates, DISTINCT

List - No Duplicates, DISTINCT

//using System;
//using System.Collections.Generic;
//using System.Linq

//


class Program {

static void Main()
{
//List<int> list = new List<int>() { 1, 2, 3, 3, 4, 4, 4 };
var myList = new List<int>() { 1, 2, 3, 3, 4, 4, 4 };

foreach (int value in myList)
{
	Console.WriteLine("Before: {0}", value);
}

//Throw only the DISTINCT elements to a list
var uniqueList = myList.Distinct().ToList();

foreach (int value in uniqueList)
{
	Console.WriteLine("After: {0}", value);
}

	
}

}