Beruflich Dokumente
Kultur Dokumente
VB.NET
A curious omission in .NET is the ability to make a deep copy of an object which is
independent of the original object – i.e. you can change the copy without changing
the original. If you simply copy an object in .NET with assignment, all you are doing is
pointing a second variable at the same object in memory, and if you change an
element of one object, you will change the other too.
https://www.rectanglered.com/deep-copying-object-vb-net 1/3
7/1/2018
If you want to do this, use Deep
this Copying
example of the de nition of a user object type ‘todo1’
an Object in VB.NET - Rectangle Red, Milton Keynes
as a guideline:
Imports System.IO
Imports System.Runtime.Serialization.Formatters.Binary
<Serializable()> _
Public Class todo1
Implements ICloneable
End Class
The parts in italics are the bits you need to add to make the object cloneable.
https://www.rectanglered.com/deep-copying-object-vb-net 2/3
7/1/2018
In your code, you can thenDeep
do Copying
this: an Object in VB.NET - Rectangle Red, Milton Keynes
https://www.rectanglered.com/deep-copying-object-vb-net 3/3