Value Types
Value types include the following:
· All numeric data types
· Boolean, Char, and Date
· All structures, even if their members are reference types
· Enumerations, since their underlying type is always SByte, Short, Integer, Long, Byte, UShort, UInteger, or ULong
Reference Types
Reference types include the following:
· String
· All arrays, even if their elements are value types
· Class types, such as Form
· Delegates
Elements That Are Not Types
The following programming elements do not qualify as types, because you cannot specify any of them as a data type for a declared element:
· Namespaces
· Modules
· Events
· Properties and procedures
· Variables, constants, and fields
Working with the Object Data Type
You can assign either a reference type or a value type to a variable of the ObjectObject variable always holds a pointer to the data, never the data itself. However, if you assign a value type to an Object variable, it behaves as if it holds its own data. For more information, see data type. An Object Data Type.
You can find out whether an Object variable is acting as a reference type or a value type by passing it to the IsReference method on the Information class in the Microsoft.VisualBasic namespace. Microsoft.VisualBasic.Information.IsReference(System.Object) returns TrueObject variable represents a reference type.
No comments:
Post a Comment