我有我想要檢索的結果匹配到這些列表的字典如何從詞典<字符串,對象>
這裏是我迄今所做
Dictionary<string, Dictionary<string, int>> SomeDictionary = new Dictionary<string, Dictionary<string, int>>();
List<int> MyList = new List<int>()
{
2,3,4,5
};
Dictionary<string, int> internalDictionary = new Dictionary<string, int>();
internalDictionary.Add("two", 2);
internalDictionary.Add("three", 3);
internalDictionary.Add("four", 4);
internalDictionary.Add("five", 5);
Dictionary<string, int> AnotherDictionary = new Dictionary<string, int>();
AnotherDictionary.Add("six", 6);
AnotherDictionary.Add("three", 3);
AnotherDictionary.Add("seven", 7);
SomeDictionary.Add("Dictionary1", internalDictionary);
SomeDictionary.Add("Dictionary2", AnotherDictionary);
var res = from l in MyList
select(from q in
(from p in
(from s in SomeDictionary
select s)
select p) where q.Value.Equals(l) select q);
的獲得價值返回的值爲null。我在想什麼?
我需要匹配KeyValuePair
其中值匹配內部字典值。
你好,你正在比較'對象'(2,3,4,...)和'strings'('「2」',...),除了'from c in col select c == col' – Carsten 2015-04-03 06:55:09
是的,我應該怎麼做? – Rohit 2015-04-03 06:59:07