I have two dictionaries like
Dictionary<String,List<String>> DictOne=new Dictionary<String,List<String>>()
Dictionary<String,List<String>> DictTwo=new Dictionary<String,List<String>>()
DictOne
KeyOne "A"
"B"
KeyTwo "C"
"D"
KeyThree "X"
"Y"
DictTwo
Key1 "X"
"Z"
"Y"
Key2 "A"
Key3 "C"
"D"
Key4 "M"
"N"
i need to compare and merge the two dictonaries regardless of the key and to add the data to the third dictionary
Dictionary<String,List<String>> DictThree=new Dictionary<String,List<String>>()
So the Third Dictionary will contain
DictThree
KeyOne "A"
"B"
KeyTwo "C"
"D"
KeyThree "X"
"Y"
"Z"
Key4 "M"
"N"
Now i'm iterating through the two dictionaries
Now i'm using like
First i'll take the First list in the DictOne and then search whether the items in the list exist in any list in DictTwo if so perform union operation and then add the resulting list into the third dictionary with the any one key (Key in DictOne or in DictTwo) If the list not exist then add the list along with the key into the third Dictionary. The same will perform for all the lists in DictOne And DictTwo
Is there any way to do this using LINQ
Thanks in advance