O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Shallow and Deep Object Cloning

The advantage of serializing with .NET Framework functions is that serialization algorithms are capable of automatically creating so-called deep clones (complete copies) of an object.

Before we proceed, here’s a bit of background. Suppose that you have an object that saves some application data. This object has a property that provides an ArrayList that contains further elements. To create a complete copy of this object, it wouldn’t be sufficient to copy the elements contained in the ArrayList, as the following example shows:

Companion Content

Open the corresponding solution file (.sln), which you can find in the \VB 2010 Developer Handbook\Chapter 20\DeepCloning folder.

Module mdlMain Sub Main() Dim locAddrOriginal ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required