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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I got confused, I have assigned objects to items in dictionary before and when i remove the entry the object ceases to exist.