I have two methods that do the same thing, one works with a Dictionary<object, List<string>> and another one with a Dictionary<object, string> doing the same thing but iterating or not the list.
I want to reduce code duplication making just a method that works with Dictionary<object, List<string>> and transforming the Dictionary<object, string> to a Dictionary<object, List<string>> with a list with only one string.
How can I do the transform preferentially with LINQ?
Thanks in advance.
Well you can’t cast the dictionary that way, but you could use: