I have the following data in a table:
e.g. data
0, 'Ford' 1, 'Toyota, Toyota' 2, 'BMW' 3, 'Porsche, Porsche' 4, 'BMW'
I need to place this data in the following type List<Tuple<int, string>> carList so that the results within my list would appear as follows:
0, 'Ford' 1, 'Toyota' 2, 'BMW' 3, 'Porsche' 4, 'BMW'
using the following pseudo code:
while (SQLiteDataReader.Read())
{
carList.Add
(
new Tuple<int, string> (
SQLiteDataReader.GetInt32(0) ,
SQLiteDataReader.GetString(1).[Some extension method to produce unique items]
);
)
}
Note, when there are items with duplication (Toyota, Porsche) , the duplication will always be the same name. i.e you won’t get something like ‘Toyota, Ford’.
Is there some extension method that would remove the duplication part?
This should do the trick: