How to get another dictionary from first setting one

Hello everyone,

I want to get new dictionary that → New Dictionary(Of String,List(of Int32)) must be this type.
But I’m getting trouble here.My first dictionary elements are here:

(Of Int32,String) From {{2006,“Oscar”},{2007,“Alberto”},{2008,“Carlos”},{2009,“Alberto”},{2010,“Andy”},{2011,“Codo”},{2012,“Bradly”},{2013,“Carlos”},{2014,“Oscar”},{2015,“Alberto”}}

My goal is like this:
I want to see when i write lets say “Oscar” the result must be “2006,2014”. If i write “Carlos” result must be “2008,2013”

I tried this workflow but couldnt get write code.

How can i solve this?

Welcome to the forum

We can do it with LINQ:



(From kvp In dictWinners
Group By k=kvp.Value Into grp=Group
Let yl = grp.Select(Function (x) x.Key).toList
Select Tuple.Create(k, yl)).ToDictionary(Function (t) t.Item1,Function (t) t.Item2)
1 Like

Thanks for your answer.I tried your code but still doesnt work.Can you send your xml?

Can you tell us what was not working? Thanks