Although value types and reference types can be extremely similar in terms of declaration syntax, the semantics of the two kinds of types are very distinct.
Reference types are always stored on the NGWS Runtime managed heap, and may only be accessed through a reference. This allows the NGWS Runtime garbage collector to track outstanding references to a particular instance and free the instance once no more references remain. Thus, a variable of reference type always contains a reference to a value of that type. Assignment to a variable of a reference type creates a copy of the reference, not a copy of the value being referenced.
Value types are normally stored directly on the stack, within an array or within another type. When the location containing a value type instance is destroyed, the value type instance is destroyed. Value types are always accessed directly and it is not possible to create a reference to a value type. This ensures that it is not possible to refer to a value class instance that has already been freed. A variable of a value type always contains a value of that type. Unlike reference types, it is not possible for a value of a value type to be Nothing
or to reference an object of a more derived type. Assignment to a variable of a value type creates a copy of the value being assigned.