C # does not indicate where an object or value should be stored. It simply defines the semantics of reference types and value types.
The Microsoft .NET CLR stores the values ββ(instances of value types) contained in local variables on the stack, and instances of reference types (objects) and nonlocal value types on the heap. However, as stated earlier, other C # language implementations are free to store things at their discretion as long as they correspond to the semantics of values ββand references defined by the C # Language Specification.
source share