Seeing the structure function struct, I am confused about the difference and usage between the object class and struct.
Search for information on the Internet:
"Struct if the data volume is small
They are in the stack and managed stack respectively.
Struct is faster, but occupies a fast memory area ."
"1. What is the most basic role of a type is to store data?
2. Does its attribute have a complete public interface to access or modify data members?
3. Will I never be confident in sub-categories of types?
4. Do I have no sense of polymorphism confidence in the type?
The above is in <valid tive C #>"
If you only store data, do not design inheritance or polymorphism, you can use struct"
"The class is the reference type, and the structure is the value type. The reference type is allocated in the heap. Memory Management is handled by the garbage collector. Value types are allocated on the stack or in combination and released when the range is exceeded. Generally, the cost of Value Type allocation and release is smaller. However, if a large number of packing and unboxing operations are required, the value type is not as good as the reference type.
Do not define the structure unless the type has all of the following features:
It logically represents a single value, similar to the primitive type (integer, double precision, etc.
The instance size is smaller than 16 bytes.
It is immutable.
It does not need to be packed frequently ."