c# dictionaries intersect

前端 未结 4 492
北海茫月
北海茫月 2021-01-01 20:48

I have a question about Linq / Lambda and the following issue:

I have two dictionaries, primary and secondary... These two dictionaries are defined as Key=string, Va

4条回答
  •  孤城傲影
    2021-01-01 21:09

    If you want to select out an object with the "value" of both dictionaries, because that what you probably want, the you can try something like this. Assuming that the keys for both dictionaries are the same i.e. that map each together, like a GUID between two systems

    dictA.Keys.Intersect(dictB.Keys).Select(x => new MyMappingClass
    {
        dictAValue= dictA[x], dictBValue= dictB[x]
    })
    

提交回复
热议问题