Get a Join on Two Dictionaries with different Datatypes in C#

后端 未结 2 906
走了就别回头了
走了就别回头了 2021-01-14 08:43

I have two dictionaries, namely

Dictionary DictA=new Dictionary();
Dictionary DictB=new Dictiona         


        
2条回答
  •  北海茫月
    2021-01-14 09:14

    DictA.Join(DictB, 
               a => a.Key,
               b => b.Key,
               (a,b) => new KeyValuePair(b.Value,a.Key))
        .ToDictionary(x => x.Key, x => x.Value);
    

提交回复
热议问题