I have two nested dictionaries. I need to compare the two dictionaries using LINQ query and validate that they are equal. The keys and values should match.
See example:
Dictionary<Type, Dictionary<int, int>> dict1 = new Dictionary<Type, Dictionary<int, int>> {
{
Type1,
new Dictionary<int, int>
{
{ 1, 1},
{ 2, 1},
{ 3, 3},
{ 4, 4}
}
},
{
Type2,
new Dictionary<int, int>
{
{ 2, 1},
{ 1, 6},
{ 4, 8},
{ 3, 5}
}
},
};
Dictionary<Type, Dictionary<int, int>> dict2 = new Dictionary<Type, Dictionary<int, int>> {
{
Type1,
new Dictionary<int, int>
{
{ 1, 1},
{ 2, 1},
{ 3, 3},
{ 4, 4}
}
},
{
Type2,
new Dictionary<int, int>
{
{ 2, 1},
{ 1, 6},
{ 4, 8},
{ 3, 5}
}
},
};
I've seen online that LINQ is the best way to do this