I would like to accomplish what the title states but I don't know how to go about doing so.
I have 2 lists:
public List<int[,]> LongList = new List<int[,]>();
public List<int[,]> UniqueList = new List<int[,]>();
To further explain, here's a scenario:
Puzzles:
public int[,] puzzle1 = new int [3,3] { {1,2,3},
{8,4,0},
{7,6,5} }; //[1,2,3;8,4,0;7,6,5]
public int[,] puzzle2 = new int [3,3] { {8,7,6},
{1,0,5},
{2,3,4} }; //[8,7,6;1,0,5;2,3,4]
public int[,] puzzle3 = new int [3,3] { {7,6,3},
{1,0,2},
{8,4,5} }; //[7,6,3;1,0,2;8,4,5]
LongList contains:
LongList.Add(puzzle1);
LongList.Add(puzzle1);
LongList.Add(puzzle1);
LongList.Add(puzzle1);
LongList.Add(puzzle2);
LongList.Add(puzzle2);
LongList.Add(puzzle3);
LongList.Add(puzzle3);
LongList.Add(puzzle3);
I would like Unique list to hold the UNIQUE values from LongList. AS IF this happened:
UniqueList.Add(puzzle1);
UniqueList.Add(puzzle2);
UniqueList.Add(puzzle3);
As an equation: UniqueList = Distinct values from LongList
List is full of multiple reoccurring values & I would like to take only the unique ones and put them into UniqueList
.
I'm trying to complete a puzzle and the LongList
will contain multiple references of the same same puzzle and more. To make it simple for case of discussion:
LongList
values: 1,1,1,1,2,2,3,4,4,4,4,5,5
I would like UniqueList
to contain the puzzles: 1,2,3,4,5