Assignments

Because structures are value types, assigning an instance of a structure to a variable declared as of that type creates a full copy of the data. The following brief code demonstrates this:

image

In the preceding code, thirdOrder is a full copy of firstOrder. You can easily check this by using the data tips feature of the Visual Studio Debugger or adding the variable to a Watch window.

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.