C# Linq merge two dictionaries
c#, functional-programming, linq, merge
Solution
To continue your duplicate discarding ways, just group up and take a winning item in the group (such as the Last one).
first.Concat(second)
.GroupBy(kvp => kvp.Key, kvp => kvp.Value)
.ToDictionary(g => g.Key, g => g.Last());
Problem
How to make the following method more functional-linq-style? ``` public static Dictionary<T, T> MergeDict<T, T>(Dictionary<T, T> a, Dictionary<T, T> b) { var e = new Dictionary<T, T>(); a.Concat(b).ToList().ForEach(pair => { e[pair.Key] = pair.Value; }); return e; } ```