I've been reading a lot of documentation on how to iterate a Dictionary with a foreach, but I don't quite understand how I can go through the levels it has. For example:
I have "params" Dictionary, I add string and object values to it, with .Add(), and to one of them I add a level called "item".
From what I understand, with the Foreach(KeyValueaPair<>) it is to iterate through the Dictionary. Do I need to use another foreach(KeyValuePair<>) to be able to loop through the second level?
For example, I want "param" to get the value of the element that Posnr brings
IDictionary<string, object> params = new Dictionary<string, object>();
params.Add("Customerid", zwCustomer.Customerid);
params.Add("PedidoCli", zwCustomer.PedidoCli);
params.Add("PedidoSap", zwCustomer.PedidoSap);
params.Add("TFacturaMat", new Dictionary<string, object>()
{
{
"item", new Dictionary<string, object>()
{
{"Vbeln", zfacturaMats.Vbeln},
{"Posnr", zfacturaMats.Posnr},
{"Matnr", zfacturaMats.Matnr},
}
},
});
foreach(KeyValuePair<string, object> item in parametros)
{
param = $"{item.Key} : {item.Value}";
}