experiments/csharp/E028-ClassMemoryAddress/Program.cs

13 lines
218 B
C#
Raw Normal View History

2024-05-04 21:16:52 +01:00
unsafe
{
var instance = new MyClass();
TypedReference instanceRef = __makeref(instance);
IntPtr instancePtr = **(IntPtr**)(&instanceRef);
Console.WriteLine($"{instancePtr:X}");
}
class MyClass
{
}