Re: TreeView Tag and clone
From: Steve Teeples (SteveTeeples_at_discussions.microsoft.com)
Date: 03/08/05
- Next message: Randy: "Re: Getting html source inside a frame (webbroser control)"
- Previous message: David P. Donahue: "Re: Web - Posting Back On A SelectedIndexChanged"
- In reply to: DalePres: "Re: TreeView Tag and clone"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Mar 2005 08:09:10 -0800
I followed your suggestion and worked on this till quite late last night. I
now have routines that clone each object. I was fortunate that the arrays
within my objects use standard types so the clone() of the arrays went
smoothly. Again, thanks much!
"DalePres" wrote:
> If your object doesn't contain other reference types, you could just use
> object.Clone() on your object. But you will have to handle it from the
> lowest level of reference types and work up.
>
> DalePres
>
> "Steve Teeples" <SteveTeeples@discussions.microsoft.com> wrote in message
> news:F6B16CCB-667B-43F5-B14B-1EA63A6703E0@microsoft.com...
> > Thanks. I guess I'll need to create a routine that makes a copy of my
> > object.
> >
> > "DalePres" wrote:
> >
> >> Clone creates a shallow copy. The Tag property is of type object, a
> >> reference type. When you change the object pointed to by the reference,
> >> all
> >> references to that object see the changes. To change the object for your
> >> new TreeNode, create a new object and assign it to the Tag property of
> >> the
> >> new TreeNode.
> >>
> >> HTH
> >>
> >> DalePres
> >> MCAD, MCDBA, MCSE
> >>
> >>
> >>
> >> "Steve Teeples" <SteveTeeples@discussions.microsoft.com> wrote in message
> >> news:9D23CF0D-26B1-4F66-AC4A-166544885675@microsoft.com...
> >> >I have TreeNodes in a TreeView, each contains unique data in its Tag
> >> >section.
> >> > I am trying to 'clone' a TreeNode and then modify the tag data of the
> >> > cloned
> >> > TreeNode. What I am seeing is that by modifying the Tag data of the
> >> > cloned
> >> > TreeNode the original TreeNode's Tag data is also being modified with
> >> > the
> >> > identical change.
> >> >
> >> > Does the clone method not create a completely new data reference of the
> >> > original TreeNode? If not, how can I get a separate copy of the Tag
> >> > data?
> >> >
> >> > --
> >> > Steve
> >>
> >>
> >>
>
>
>
- Next message: Randy: "Re: Getting html source inside a frame (webbroser control)"
- Previous message: David P. Donahue: "Re: Web - Posting Back On A SelectedIndexChanged"
- In reply to: DalePres: "Re: TreeView Tag and clone"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|