Define reference type and value type.Value type
- If a data type holds the data within its own memory allocation it is of value type.
The different types are as follows:
a. All numeric data types b. Boolean, Char, and Date c. All structures, even if their members are reference types d. 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.
Reference Types
- This type contains a pointer to another memory location which holds the data.
The different types are as follows:
a. String b. All arrays, even if their elements are value types c. Class types, such as forms d. 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.
|