我正在阅读 Jon Skeet 的书评,他正在阅读 numerous inaccuracies的 Head First C# .
其中一个引起了我的注意:
[Under Errors Section] Claiming that structs always live on the stack.
在什么情况下结构不会存在于堆栈中?这与我自认为对结构的了解背道而驰。
最佳答案
一个常见的例子是结构是在堆中分配的对象的成员。这个问题在这里有很多额外的细节。 What’s the difference between struct and class in .Net?
关于c# - 什么时候结构不在栈上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/531520/