{key1: value1}, and dict2 = {value1: value2}. I have to construct another dict3 = {key1: value2}, how to do that in c#?
var dict3 = dict1.Keys.ToDictionary( v => v, v => dict2[dict1[v]]); I think something like this can do. Iterate over the keys of dict1, and convert such a list to a dictionary by keeping the keys as the value being iterated and its associated value as the mapping derived from dict2.
Обсуждают сегодня