I'm not sure if the title of the question is correct ..
I need a Customs List of Objects, which inside has another Custom object, this last object has several properties. To the problem
I need to read an Excel, which has many Books, each Book has many Records. I already do that but I need everything in a single object.
Currently I get the names as follows.
var worksheetNames = excelSheet.GetWorksheetNames().ToList();
This returns a List of string with the names, then with a for this list, I get the values of each book.
for (int z = 0; z < worksheetNames.Count; z++)
{
List<RegistrosExcel> Resultado = new List<RegistrosExcel>();
Resultado = excel.ToEntidadHojaExcelList(fichero, worksheetNames[z]);
}
And process ...
What I want to have, is a single object with all the values of all the books inside. Something like this:
//Asi es como lo necesito pero no lo consigo
MiObjeto.Nombres = excelSheet.GetWorksheetNames().ToList();
for (int z = 0; z < MiObjeto.Nombres.Count; z++)
{
MiObjeto[z].Registros = excel.ToEntidadHojaExcelList(fichero, MiObjeto[z]);
}
This way it will be easier for me to read the data, in the end I want to have a control like that.
MiObjeto[z].Registros[i].Algo
MiObjeto.[Nombre Del Libro].Regitros[No Registro].Total
Greetings