This blog defines Value and reference types in VB.NET.
Value Type
A data type is a value type if it holds the data within its own memory allocation. Value types are stored directly on the stack. Value types can not contain the value null. We assign a value to that variable like this: x=11. When a variable of value type goes out of scope, it is destroyed and it's memory is reclaimed.
- 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
For example
The following code defines an int type variable. int type is a value type.
Module Module1
Sub Main()
Dim m As Integer = 5
Dim n As Integer = m
m = 3
Console.WriteLine("m=" & m)
Console.WriteLine("n=" & n)
End Sub
End Module
OUTPUT
![]()

Join the conversation! Your thoughts help the community grow.