Ejemplo n.º 1
0
        public static CriticalAllocHandle FromBlob <T>(T id)
        {
            CriticalAllocHandle handle = CriticalAllocHandle.FromSize(Marshal.SizeOf(typeof(T)));

            Marshal.StructureToPtr(id, (IntPtr)handle, false);
            return(handle);
        }
        public static CriticalAllocHandle FromGuid(Guid input)
        {
            int guidSize = Marshal.SizeOf(typeof(Guid));
            CriticalAllocHandle result = CriticalAllocHandle.FromSize(guidSize);

            Marshal.Copy(input.ToByteArray(), 0, (IntPtr)result, guidSize);
            return(result);
        }
        public static CriticalAllocHandle FromGuid(Guid input)
        {
            int size = Marshal.SizeOf(typeof(Guid));
            CriticalAllocHandle handle = CriticalAllocHandle.FromSize(size);

            Marshal.Copy(input.ToByteArray(), 0, (IntPtr)handle, size);
            return(handle);
        }
        public static CriticalAllocHandle FromBlob <T>(T id)
        {
            int size = Marshal.SizeOf(typeof(T));
            CriticalAllocHandle result = CriticalAllocHandle.FromSize(size);

            Marshal.StructureToPtr(id, (IntPtr)result, false);
            return(result);
        }
 public void AllocateBlob(int size)
 {
     data   = CriticalAllocHandle.FromSize(size);
     cbData = size;
 }