Results 1 to 5 of 5

Thread: Collection/Structure within Class

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164

    Question Collection/Structure within Class

    I need to have a collection (I think) in my class and I needed some examples or other sites that could help.

    I really need to be able to do stuff like:

    myClass.layer("red").visible = true
    myClass.layer("blue").visible = false

    where layer is my collection in my class, red and blue are string keys, visible is a property of the structure, etc. I also need to be able to get/set and add/remove the items.

    anyone have any good sites or examples to help?

    thanks,
    -Shurijo

  2. #2
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382
    Why not just put a Hashtable inside your class, I do that quite often

    Private ColorTable as New HashTable()

    Then you can add the objects and remove them as needed by the key color

    ColorTable.Add("Red", Object)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164
    What's a hashtable?

    And color doesn't have anything to do with the actual data, I just used that as an example. There will be +5 properties for each item and I need to be able to get the item by the key. I have some old vb6 code at home that does this using collections, type, and arrays or structures, but I forgot how it worked.
    -Shurijo

  4. #4
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382
    A Hashtable is just another form of a collection, it's basically a collection on steroides.. You can Add ANYTHING to a hashtable, any value, any object, any class. And the hashtable uses keys to sort it's data.. just play with it, you will find it very easy to use..

  5. #5
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    if u know what u'll put as probably u'll know why and if the propriesties are gonna be all the same why not put get / set's?
    \m/\m/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width