How .NET distinguishes links from primitive and value types

.NET we have primitive data types, such as int and value types, such as struct.

And also we have reference types. All of them are apparently derived from a class of objects.

How does .NET define a primitive value type for a reference type?

Where is this done? In the compiler or in JIT?

Does this relate to compiler capabilities?

+5
source share
3 answers

All value types, including the built-in Common Type System (CTS) primitives, are made DIRECTly using the CTS type "System.ValueType" (except for enumerations).

, , . "System.ValueType", , .

: ,

public Enum Shipper {FedEx, Aerborne, USPS, Stork}

... System.ValueType, System.Enum, System.ValueType...

+11

System.ValueType, System.Object.

+2

System.ValueType, , , ( ) GetHashCode Equals. ( , ).

, int, IL box. IL .

- .

, unsafe object. EDIT - .

+2
source

All Articles