Tom Knowlton
asked on
C# Best Practice: List<T> of List<T> or List< List<T>> -- better way?
I know you can have a List< List<T> >. But there is something about it that seems strange to me.
What I am wanting is to have a TableClass which has a List < Row Class >. Each Row Class is a List< Cell Class >.
Is there a nicer / cleaner way to represent this other than:
TableClass<RowClass<CellCl ass>>
In other words:
Better way?
What I am wanting is to have a TableClass which has a List < Row Class >. Each Row Class is a List< Cell Class >.
Is there a nicer / cleaner way to represent this other than:
TableClass<RowClass<CellCl
In other words:
public class TableClass
{
public TableClass() { }
public List<RowClass> Rows { get; set; }
}
public class RowClass
{
public RowClass() { }
public List<CellClass> Cells { get; set; }
}
public class CellClass
{
public CellClass() { }
}
Better way?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is not clear what you wish to accomplish and I am wondering if you are not trying to re-invent the wheel here, for example a DataTable object?
ASKER
p_davis:
Not a bad idea.
Fernando Soto:
I know about DataTables. I kind of [want] something like a DataTable - but not nearly as heavy in methods and features .. just basic navigation and querying, with a few additional attributes for my purposes.
Maybe it is a dumb question. I just think List<List<T>> is kind of hookey - inelegant.
Not a bad idea.
Fernando Soto:
I know about DataTables. I kind of [want] something like a DataTable - but not nearly as heavy in methods and features .. just basic navigation and querying, with a few additional attributes for my purposes.
Maybe it is a dumb question. I just think List<List<T>> is kind of hookey - inelegant.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.