1. 程式人生 > >在結構體中獲得this指標地址

在結構體中獲得this指標地址

 unsafe { 

fixed (void* p = &this) 

 IntPtr Ptr = new IntPtr(p);

}

}

這是目前唯一獲得結構體或類的this指標地址的方法。需要編譯器開啟 /Unsafe選項。