c# - Checking the value of a word in different dictionary then in the loop -


i've got 2 dictionaries, looking through 1 of them , want math if value of same key in other dictionary more 5.

how can make if statement correctly?

foreach (var word in dict1) {                   temp = word.value;      // this:     if (temp in dict2 > 5)     {         *= temp;     }     else     {         // nothing     } } 

if using dictionary both dict1 , dict2:

foreach(var word in dict1.where(w=>dict2.containskey(w.key) && dict2[w.key]>5)) {     //dowork } 

this iterates items in dict1 have value greater 5 in dict2 , work.

edit: added dict2.containskey(w.key) check in clause since possible dict2 won't contain key in dict1.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -