The value type allocates memory space in the stack and saves the data;
The reference type allocates memory space on the heap and saves the data, and stores the data address in the heap to the stack;
After a value-type variable is declared, the compiler allocates memory for it, regardless of whether it has been assigned.
Reference type when declaring a class, only a small piece of memory is allocated to the stack to hold an address, at which time it is not allocated a memory space on the heap. When you use new to create an instance of a class, allocate space on the heap and save the address of the space on the heap to a small space allocated on the stack.
Instances of value types are typically allocated on the thread stack (static allocations), but in some cases can be stored in the heap.
Objects of reference types are always allocated (dynamically allocated) in the process heap.
C # Value types and reference types