public static ManagedAllocation Create(object structure) { var s = new ManagedAllocation(); s.Size = Marshal.SizeOf(structure); s.Pointer = Marshal.AllocHGlobal(s.Size); Marshal.StructureToPtr(structure, s.Pointer, false); return s; }
public static ManagedAllocation Create(object structure) { var s = new ManagedAllocation(); s.Size = Marshal.SizeOf(structure); s.Pointer = Marshal.AllocHGlobal(s.Size); Marshal.StructureToPtr(structure, s.Pointer, false); return(s); }