.NET we have primitive datatypes like int and value types like struct.
And also we have reference types. All of them seem to be derived from object class.
How .NET determine primitive, value type against the reference type?
Where it is done? At compiler or at JIT?
Does this belongs to the capabilities of the compilers?
All value types, including built-in Common Type System (CTS) primitives, derive DIRECTLY from the CTS type “System.ValueType”, (except enums).
So the compiler can tell by examining any types’ base type. If it is “System.ValueType”, then it’s a value type, otherwise, it’s a reference type.
Edit: Enums, as in
… do not derive Directly from System.ValueType, they derive from System.Enum, which derives from System.ValueType…