Re: Framework 3.5 Copy POCO?
Mike Andrews <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
Implement ICloneable and then return the MemberwiseClone() method. However this only does a shallow copy and not a deep copy so if you have properties that are reference types, you'll get the same reference again in the cloned copy. On Tue, Nov 4, 2008 at 6:04 AM, SteveC <[email protected]> wrote: > With .NET Framework 3.5, what is the best/fastest/slickest way to make a > (non-reference) copy of the object of a Plain Old C Sharp Object? > > > > //My Sample > > public class MyClass > > { > > private string _mystring; > > > > public string MyString > > { > > Get { return _mystring } > > Set { _mystring = value} > > } > > > > public int IntWithNoPriv { get; set; } > > > > } > > > > > > Thanks. > > > =================================== > View archives and manage your subscription(s) at > http://peach.ease.lsoft.com/archives > =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives