Value
Type
A data type is a value
type if it holds the data within its own memory allocation. 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
Every structure is a
value type, even if it contains reference type members. For this
reason, value types such as Char and Integer are implemented by .NET
Framework structures.
You can declare a value
type by using the reserved keyword, for example, Decimal. You can
also use the New keyword to initialize a value type. This is
especially useful if the type has a constructor that takes
parameters. An example of this is the Decimal(Int32, Int32, Int32,
Boolean, Byte) constructor, which builds a new Decimal value from the
supplied parts.
Reference
Types
A reference type contains
a pointer to another memory location that holds the data. Reference
types include the following:
String
All arrays, even if
their elements are value types
Class types, such as
Form
Delegates
A class is a reference
type. For this reason, reference types such as Object and String are
supported by .NET Framework classes. Note that every array is a
reference type, even if its members are value types.
Comments
Post a Comment