How does .net managed memory handle value types inside objects?

前端 未结 6 1829
[愿得一人]
[愿得一人] 2021-01-18 21:42
public class MyClass
{
    public int Age;
    public int ID;
}

public void MyMethod() 
{
    MyClass m = new MyClass();
    int newID;
}

To my un

6条回答
  •  情歌与酒
    2021-01-18 21:49

    1. Any references or value types that an object own live in the heap.
    2. Only if you're casting ints to Objects.

提交回复
热议问题