I have multiple dictionaries<string, list(this list will always have 2 items)>
DictOne = ["january", [good, bad]]
DictTwo = ["february", ["bad", "average"]]
DictThree = ["january", ["great", "decent"]]
Ignore the initialisation syntax above(its just sudocode i have writtem here)
Here the key “January” is duplicate so the below 2 codes I have tried doesn’t work
Expected output would be:
[“january”, [good great, bad decent]]
[“february”, [“bad”, “average”]]
var resultDict = DictOne.Concat(DictTwo).Concat(DictThree).ToDictionary(x=>x.Key,x=>x.Value);
var resultDict = DictOne.Concat(DictTwo).Concat(DictThree).GroupBy(b => b.key)
.ToDictionary(b => b.Key, b.ToList() );