Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.LocalAlloc C# (CSharp) Method

LocalAlloc() static private method

static private LocalAlloc ( int cb ) : SafeLocalAllocHandle
cb int
return SafeLocalAllocHandle
        internal static SafeLocalAllocHandle LocalAlloc(int cb)
        {
            SafeLocalAllocHandle result = Interop.Kernel32.LocalAlloc(Interop.Kernel32.LMEM_FIXED, (UIntPtr)cb);
            if (result.IsInvalid)
            {
                result.SetHandleAsInvalid();
                throw new OutOfMemoryException();
            }
            return result;
        }