I have the following dictionary:
Dictionary<int,string> dic = new Dictionary<int,string>(); dic[1] = "A"; dic[2] = "B";
I want to filter out the dictionary elements and reassign the result to the same variable:
dic = dic.Where (p => p.Key == 1);
How to return the result in the form of a dictionary from the same type [ <int,string> ]?
I tried ToDictionary , but it does not work.
Thanks in advance.
dictionary c # linq linq-to-objects
Homam Oct 21 2018-10-10 15:13
source share