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

Changing the Values of Interface-Boxed Value Types

During boxing and unboxing of value types, behaviors can occur that are hard to trace at first glance. As you saw previously, accessing a member of a value type automatically leads to the immediate boxing of the value type in question into an object. The following example demonstrates the implications of this behavior, and illustrates why such behaviors can differ significantly, even though you are dealing with the same value type instances.

Companion Content

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

Interface IMustHaveValue Property Value() As Integer End Interface Module mdlMain Sub Main() Dim AValueType As New ValueType(10) ...

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