C# Reset a property
Posted
by Jeff
on Stack Overflow
See other posts from Stack Overflow
or by Jeff
Published on 2010-01-20T20:11:34Z
Indexed on
2010/03/26
5:03 UTC
Read the original article
Hit count: 374
I'm writing a Clone function for a non serializeable object.For most objects I don't care if they are shallow copied as I won't be making any changes to them.
I start with a MemberwiseClone and this copies all the values and few objects like configuration dictionary over just fine but they are pointers.
EAVEntity newClone = (EAVEntity) this.MemberwiseClone();
newClone.EntityStorageID = Guid.NewGuid();
newClone.Controls.Clear();
So how do I reset a pointer so I can make them not point at the same location?
© Stack Overflow or respective owner