I'm sure it's a stupid question, but I cannot find an easy way to group a list by another list. I searched a lot on the internet, but I found only examples with class properties or sorting elements.
I have a string list with keys, for example:
List<string> keys = new List<string>();
keys.Add("a");
keys.Add("a");
keys.Add("b");
keys.Add("a");
keys.Add("c");
keys.Add("c");
keys.Add("a");
keys.Add("b");
and an int list I want to group by the key list, for example:
List<int> vals = new List<int>();
vals.Add(10);
vals.Add(11);
vals.Add(12);
vals.Add(13);
vals.Add(14);
vals.Add(15);
vals.Add(16);
vals.Add(17);
So the result should be a list with sublists like:
{{10,11,13,16},{12,17},{14,15}}
Or maybe also get indices. Thanks in advance.