C# unsafe模式内存操作深入探索
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class CTile { public CTileData _dat; public int x; } //结构体可能分配在堆上,也可能分配在栈上 //1,结构体中无引用类型,则: //a:若该结构体类型的变量X是类的内部成员,由于类是引用类型,则X分配在堆上 //b:若非a的情况,则结构体分配在栈上 unsafe struct CTileData