When I run this portion of the code in my program, the output is:
False
True
Why is this?
Sponsor Sponsor
person
Posted: Sat Nov 22, 2008 8:58 pm Post subject: Re: Linked List Problem in C#
Btw, the linked lists are instances of a class called List which contains a variable to hold a value and a variable to hold a variable of type List which points to another value and List. So I don't think this is an issue of pointers since I don't believe they are pointing to the same location in memory.
OneOffDriveByPoster
Posted: Sat Nov 22, 2008 10:53 pm Post subject: Re: Linked List Problem in C#
person @ Sat Nov 22, 2008 7:38 pm wrote:
code:
foo = bar;
Why do you believe that foo would be different from bar after that?
rdrake
Posted: Sat Nov 22, 2008 11:52 pm Post subject: RE:Linked List Problem in C#
Foo is not a clone of bar, it's just a reference to it. Try making the line say something like foo = bar.Clone() and see what happens.