How can I filter a dictionary using LINQ and return it to a dictionary from the same type
Solution 1:
ToDictionary
is the way to go. It does work - you were just using it incorrectly, presumably. Try this:
dic = dic.Where(p => p.Key == 1)
.ToDictionary(p => p.Key, p => p.Value);
Having said that, I assume you really want a different Where
filter, as your current one will only ever find one key...