To sum up, there are two differences:
1, the structure is a value type, and the class is a reference type. So the former is placed in stacks, while the latter simply stores the reference address in the stack, while the specific value is stored in the heap (heap). As shown in the following illustration:
2, according to the 1th, it can be concluded that class objects are usually used to pass large data, while structural objects are used to pass small data.
3, the class can be inherited, but the structure is not supported.
4. A struct object cannot be assigned a null value like a class object.
5. Structs cannot define a destructor like a class.
6. The structure cannot be defined as abstract as a class.
7. A method cannot be overridden in a struct unless it is the following method of type object:
Equals ()
GetHashCode ()
GetType ()
ToString ()
To allow the structure to have polymorphic properties, you can make it implement an interface.
8. The events defined in the class are thread-safe and the struct is not.