Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. What is favorable : structure or class stored in TreeView.Node.Tag?

What is favorable : structure or class stored in TreeView.Node.Tag?

Scheduled Pinned Locked Moved Visual Basic
performancequestiondatabasehelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marc Sommer
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • M Marc Sommer

      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

      J Offline
      J Offline
      Jim Stewart
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • J Jim Stewart

        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

        M Offline
        M Offline
        Marc Sommer
        wrote on last edited by
        #3

        "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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups