public IntPtr ToIntPtr() { IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); Marshal.StructureToPtr(this, ptr, false); return ptr; }