Where are .NET local variables stored?

前端 未结 3 1584
独厮守ぢ
独厮守ぢ 2020-12-06 11:12

In IL, you can define local variables using the .locals directive. Where are these variables stored, stack or heap?

3条回答
  •  情深已故
    2020-12-06 11:45

    If the object is not a value type, it is allocated on the heap and a reference to it is stored on the stack. Otherwise, it is directly allocated on the stack.

提交回复
热议问题