What is favorable : structure or class stored in TreeView.Node.Tag?
-
Hello, I have to store several individual pieces of information gained from database in corresponding nodes (in tag property) of a treeview. eg.
node.text = dr.item("name") object.type = dr.item("type") object.subtype = dr.item("subtype") object.level = dr.item("level") ... ... node.tag = object
The most convenient datastructures seem to me to be either structures or class objects. Structures are a bit easier to handle, as they have no to be instantiated each time information has to be stored in a node. I would be interessted in the best way to do for small amount and for huge amount of treenodes. What is more favorable concerning speed and memory consumption : structures or class objects? Many thanks for your help. Shrinkers -
Hello, I have to store several individual pieces of information gained from database in corresponding nodes (in tag property) of a treeview. eg.
node.text = dr.item("name") object.type = dr.item("type") object.subtype = dr.item("subtype") object.level = dr.item("level") ... ... node.tag = object
The most convenient datastructures seem to me to be either structures or class objects. Structures are a bit easier to handle, as they have no to be instantiated each time information has to be stored in a node. I would be interessted in the best way to do for small amount and for huge amount of treenodes. What is more favorable concerning speed and memory consumption : structures or class objects? Many thanks for your help. ShrinkersBecause structures are value types, and because the tag property is that of
Object
, the structure must be boxed and unboxed as it is assigned and read, thus incurring some overhead. Performance testing would be necessary to see if the overhead is onerous.α.γεεκ
Fortune passes everywhere.
Duke Leto Atreides -
Because structures are value types, and because the tag property is that of
Object
, the structure must be boxed and unboxed as it is assigned and read, thus incurring some overhead. Performance testing would be necessary to see if the overhead is onerous.α.γεεκ
Fortune passes everywhere.
Duke Leto Atreides"the structure must be boxed and unboxed" -> In opposition, each object of type custom class must be instanciated. What would propbably cost more overhead? Is there a difference, where objects of type class and structures are stored in memory internally ? I heard something about heap, stack , .... What would be the consequences of this objects stored at different places in memory concerning speed , memory consupmtion, overhead? Can anybody help? Thanks Marc Sommer