c# - creating a new dictionary out of 2 matching ones -


 labelmap = new dictionary<string, int>();  branchlinemap = new dictionary<string, int>(); 

if 1 key of first dictionary matches key of other dictionary need make new dictionary value of branchlinemap become key , value of labelmap become value. how do while iterating on whole dictionary?

using where , todictionary methods, can this:

var newdictionary = labelmap                    .where(x => branchlinemap.containskey(x.key))                    .todictionary(x => branchlinemap[x.key], x => x.value); 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -