internal UnmanagedPointer(Type objtype, bool allocstruct = false, AllocMethod method = AllocMethod.HGlobal) { m_type = objtype; m_meth = method; m_struct = allocstruct; m_ptr = (m_meth == AllocMethod.CoTaskMem) ? Marshal.AllocCoTaskMem(Marshal.SizeOf(objtype)) : Marshal.AllocHGlobal(Marshal.SizeOf(objtype)); }
public HeapPtr(int byteLength, AllocMethod method) { m_len = byteLength; if (!Enum.IsDefined(typeof(AllocMethod), method)) { throw new ArgumentOutOfRangeException("method"); } if (byteLength < 0) { throw new ArgumentOutOfRangeException("byteLength"); } m_method = method; switch (method) { case AllocMethod.HGlobal: m_ptr = Marshal.AllocHGlobal(byteLength); break; case AllocMethod.CoTaskMem: m_ptr = Marshal.AllocCoTaskMem(byteLength); break; } }
public HeapPtr(int byteLength, AllocMethod method) { m_len = byteLength; if (!Enum.IsDefined(typeof(AllocMethod), method)) throw new ArgumentOutOfRangeException("method"); if (byteLength < 0) throw new ArgumentOutOfRangeException("byteLength"); m_method = method; switch (method) { case AllocMethod.HGlobal: m_ptr = Marshal.AllocCoTaskMem(byteLength); break; case AllocMethod.CoTaskMem: m_ptr = Marshal.AllocCoTaskMem(byteLength); break; } }
internal UnmanagedPointer(IntPtr ptr, AllocMethod method) { m_meth = method; m_ptr = ptr; }
public UnmanagedPointer(IntPtr ptr, AllocMethod method) { _m = method; _p = ptr; }
internal UnmanagedPointer(IntPtr ptr, AllocMethod method) { _method = method; _ptr = ptr; }