I have a function which returns a List<Dictionary<string, object>> where object is a standard type (string, int, etc).
I need to take a second List<Dictionary<string, object>> and ensure that All entries in list B are represented in List A (order in the list does not matter).
Currently I have code that looks like this:
foreach(Dictionary<string, object> rowResult in A) {
foreach(Dictionary<string, object> rowCompare in B) {
foreach(string columnName in rowResult.Keys) {
// ... logic to compare columns
}
}
// ...logic to compare rows so we dont find the same row twice.
}
Is there a more straightforward way to do this?
We dont care that all rows in rowResult are found, but all rows in rowCompare must be. It is ok to remove rows from the compare or result set to make the iteration easier.
My code works, it just looks over complicated and fragile.
Then: