Search code examples
.netvalue-typereference-type

Where are value types defined in a reference type stored (heap or stack)?


Are the value types defined inside a reference type stored on the heap or on the stack?

  1. If stored on the heap, then when are value types stored on the stack?
  2. If stored on the stack, then what goes inside the heap as everything ends at a value type in the end?

Solution

  • Memory in .NET - what goes where by Jon Skeet