Tag Property - What does it do and how does it work?

In my blackjack game, our teacher suggested to use the Tag property to keep track of things. I'm guessing he meant values of the cards. I have 2 books on C# and neither one of them talks about the Tag property. I also haven't found much online that helps me figure out how to use it?

How does one go about using the Tag property with an image list of 52 different cards?

Also, can anyone point me to a decent website that may help explain the Tag property's use?

Thanks!

Comments

  • : In my blackjack game, our teacher suggested to use the Tag property to keep track of things. I'm guessing he meant values of the cards. I have 2 books on C# and neither one of them talks about the Tag property. I also haven't found much online that helps me figure out how to use it?
    :
    : How does one go about using the Tag property with an image list of 52 different cards?
    :
    : Also, can anyone point me to a decent website that may help explain the Tag property's use?
    :
    : Thanks!
    :

    Well, the "Tag" property data type is "Object". So, you can throw in whatever (class) you want.
    It's its function: to keep your data (that's why it's an "Object" data type) inside the user interface. Not much to explain.

    For instance, in a Tree control (TreeView? Can't remember its name), every node has its own Tag. So you could easily create a tree, and if you put the object a given node represents into a Tag, you'll always have Tree Nodes and your object in a synchronized data structure (ie-organized as a tree).
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion