B
Brett Wickard
Ok, this should be simple, but how do I copy a reference type by value?
Meaning
SomeComplexObject s1 = new SomeComplexObject ();
SomeComplexObject s2 = new SomeComplexObject ();
s1.color = "red";
s2 = s1;
s2.color = "blue";
I want to copy s1 to s2 and have them point to different points in memory,
so that if I change s2.color I won't change s1.color... How do I do that?
The actual object has like 30-ish parameters so I'm hoping I don't have to
assign each one separately!
Meaning
SomeComplexObject s1 = new SomeComplexObject ();
SomeComplexObject s2 = new SomeComplexObject ();
s1.color = "red";
s2 = s1;
s2.color = "blue";
I want to copy s1 to s2 and have them point to different points in memory,
so that if I change s2.color I won't change s1.color... How do I do that?
The actual object has like 30-ish parameters so I'm hoping I don't have to
assign each one separately!