I have 2 dictionaries(key value pair objects) in C#. I want to compare dictionaries A with B and do the following for any keys that are in both dictionaries:
1. Replace the value in dictionary A with the value in dictionary B
2. Remove the matching key from dictionary B
An example would be as follows:
Initial dictionaries:
A={" Key1:value1 "," Key2:value2 "}
B={" Key3:bla "," key1:hello "," Key4:bla "," Key2:world "}
Afterward:
A={" Key1:hello "," Key2:world "}
B={" Key3:bla "," Key4:bla "}
I would like to know the best way to do this, I'm sure this can be achieved in LINQ but I am still just a beginner, any help is greatly appreciated.