Okay to Declare DataTable In a Structure?

KeysCoder

Member
Joined
Apr 10, 2006
Messages
18
Location
Florida Keys
Programming Experience
3-5
I often use structures to group various friend variables into logical categories. Is there any reason why I shouldn't declare a datatable in a structure?

I ask because I'm not clear on some of the memory limitations of various objects in .net.
 
Declare a datatable in a structure? Would you even still need a struct if your storing data in a table?

Second a dataset or datatable will use more resources then a user defined structure. So it would depend on how much info you need to store and if it would be worth the extra resources to use a class or datatable compared to a simple user defined struct.
 
Like I said, I like to use structures to group friend variables.

I have a program which utilizes a treeview control. The tree structure is loaded into a datatable from a database. I need the datatable. I declare the datatable in a structure called fNodes along with a few other friend variables of different types related to tree nodes.

The whole point of the structure is just to group different kinds of variables related to the treeview control. A datatable is one of them. The others are simple variables like integers. It's just to make things tidy.

Is that bad practice?
 
Last edited:
Back
Top