I have the following list:
List<String> datos = new List<string>();
In it I keep the following data:
datos.Insert(0, nomMaterial); //Material1
datos.Insert(1, "$" + costoMaterial);//500.00
datos.Insert(2, areaCuadrada);//80m2
datos.Insert(3, "$" + costoTotal);//40,000
datos.Insert(0, nomMaterial);//Material2
datos.Insert(1, "$" + costoMaterial);//200
datos.Insert(2, areaCuadrada);//40m2
datos.Insert(3, "$" + costoTotal);//8,000
datos.Insert(0, nomMaterial);//Material1
datos.Insert(1, "$" + costoMaterial);//500.00
datos.Insert(2, areaCuadrada);//20m2
datos.Insert(3, "$" + costoTotal);//10,000
datos.Insert(0, nomMaterial);//Material2
datos.Insert(1, "$" + costoMaterial);//200.00
datos.Insert(2, areaCuadrada);//10m2
datos.Insert(3, "$" + costoTotal);//2000
I would like that for each Material that is repeated the amounts to be added to group them and in the end to show a summary of both, example:
Material: Material1 Cost: 500 SumaArea = 100m2 TotalSum = 50,000
Material: Material2 Cost: 200 SumaArea = 50m2 TotalSum = 10,000
The cost of each material will always be the same, what interests me is to know how to group them to obtain the sum of their areas and the total price without having to show one by one, I hope it was clear, thank you very much.