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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -