In C #, many data types are defined by the struct type and belong to the value type.
C # The defined class belongs to the reference type.
For specific analysis of the differences between the two, we need to mention heap and stack. Stack is a back-to-first-out data structure and a memory area supported by the processor, some local variables are stored, and the heap is a dynamically allocated memory area.
C # The value type is allocated to the stack, and the reference type is allocated to the heap;
Everything in C # is an object, including data types. Some data types in C # are defined by struct, and struct is inherited by valuetype, valuetype is inherited from the object, so the value type is also an object.
C # The Memory recycler recycles the stack memory after the stack framework ends. For example, if the stack framework is defined in the method, some variables defined in the method will be recycled after the method ends;
Objects defined in the heap can be recycled only after the last object is referenced. There is a big difference between the two.