Is it possible to make a method that takes a Dictionary with a key of generic type and a value of IEnumerable of generics? Such as
private static bool AreDictionariesOfObjectAndListEqual<TKey, IEnumerable<T>>(Dictionary<TKey, IEnumerable<T>> dict1, Dictionary<TKey, IEnumerable<T>> dict2)
{
var dict1String = string.Join(",",
dict1.OrderBy(kv => kv.Key).Select(kv => kv.Key + ":" + string.Join("|", kv.Value.OrderBy(v => v))));
var dict2String = string.Join(",",
dict2.OrderBy(kv => kv.Key).Select(kv => kv.Key + ":" + string.Join("|", kv.Value.OrderBy(v => v))));
return dict1String.Equals(dict2String);
}
The equality code comes directly from the answer here: https://stackoverflow.com/a/45606892/8657968