I have a structure like this
List<X> tableX;
class X
{
List<Y> tableY;
}
class Y
{
string Name;
int data;
}
Are there a method to flatten it to a dictionary, which I can input the table name and index to get Y like this
var dict = tableX
.SelectMany(x => x.tableY)
.ToDictionary(y => $"tableX[{index of x}].tableY[{index of y}]");
Y Yij = dict["tableX[i].tableY[j]"]