Difference between Value types and Reference types
Value types
|
Reference types
| |
Variable content
|
Value
|
Reference
|
Stored
|
Stack
|
Heap
|
Assignment
|
Value
|
Reference
|
Initial value
|
0, false,’\0’
|
null
|
Ranges
Type
|
Range
|
byte
|
0 .. 255
|
sbyte
|
-128 .. 127
|
short
|
-32,768 .. 32,767
|
ushort
|
0 .. 65,535
|
int
|
-2,147,483,648 .. 2,147,483,647
|
uint
|
0 .. 4,294,967,295
|
long
|
-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807
|
ulong
|
0 .. 18,446,744,073,709,551,615
|
float
|
-3.402823e38 .. 3.402823e38
|
double
|
-1.79769313486232e308 .. 1.79769313486232e308
|
decimal
|
-79228162514264337593543950335 .. 79228162514264337593543950335
|
char
|
Unicode character.
|
string
|
String of Unicode characters.
|
bool
|
True or False.
|
object
|
An object.
|