Join two dictionaries using a common key

前端 未结 4 1003
广开言路
广开言路 2021-02-09 23:28

I am trying to join two Dictionary collections together based on a common lookup value.

var idList = new Dictionary();
idList.Add(1, 1);
idList.A         


        
4条回答
  •  情话喂你
    2021-02-09 23:45

    I apologize if I misinterpretted your question, but do you just want to retrieve the Values from list B only where list A has a KeyValuePair with the same Key?

    from lookup in lookupList
    where idList.Keys.Contains(lookup.Key)
    select lookup.Value;
    

提交回复
热议问题