Link to home
Start Free TrialLog in
Avatar of San24
San24

asked on

Tag and Object

Experts,

I`m using C# .Net 3.5 VS 2008

Lets say I assign the Tag property of an object to a custom object, if I destroy the object the custom object should also be destroyed right?

For example : I assign a Custom Object - CarObj to a Treeview Node.

TreeNode.Tag = CarObj;

If I remove the TreeNode, the CarObj should also be removed right? From what I see CarObj still exists, How do I solve this issue?
SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of San24
San24

ASKER

Thanks infomaniac. The issue is resolved.

I got confused, I have assigned objects to items in dictionary before and when i remove the entry the object ceases to exist.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of San24

ASKER

@Kaufmed - Doesn`t Node.Remove() destroy the TreeNode?

Getting rid of the TreeView is not an option. But I resolved this issue by casting the Tag as an object and removing it. Let me know if you are interested in the solution.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial