Franki1986
Franki1986

Reputation: 1436

DataSet with DataTables vs Dictionary with DataTables

What combination is less memory hungry:

A DatatSet with multiple DataTables or a Dictionary with multiple DataTables?

I only need a Collection of DataTables, the whole functions of a DataSet is not required...

Upvotes: 0

Views: 2169

Answers (1)

Tim Schmelter
Tim Schmelter

Reputation: 460228

The difference will be negligible, so i would use a DataSet since it's the appropriate container for multiple tables. But you could also use a DataTable[] or List<DataTable>. It's up to you.

In terms of memory consumption the difference (if any) is irrelevant. Chose the type of collection which is most appropriate for your task. If you need to lookup the table by name use a DataSet or Dictionary<string, DataTable>. If you just need a collection for multiple tables chose IList<DataTable>(array or list). As already stated, i would use a DataSet because it's the natural collection for DataTables.

Upvotes: 3

Related Questions