Hello guys,
I have a list containing multiple values.
List <string> yourList = new List () {"012345", "032165", "211458", "214563", "098796", "574623", "894235", "3135698"};
as you can see, each digit can be 0-9.
Now what I want is to create a new list, first picking only the first digit of each element of the list. my new list would look like this:
[0, 0, 2, 2, 0, 5, 8, 3]
I learned on this forum how to do this, this way:
List <string> firstDigits = yourList.Select (x => x.Substring (0, 1)). ToList ();
Now comes my question, I wonder if I have to create this new list without repeating digits. For example, I've added a number 2 and again find the "2" would not be added to the same list. then the list would only like this:
[0, 2, 5, 8, 3] which are the first digit of each element in the main list, but without repetition.
does it have to do this? I appreciate the help