public void DoTest() { var libsum = NativeLibBufferMethods.GetDataSum(_handle); var size = NativeLibBufferMethods.GetDataSize(_handle); var answer = Enumerable.Range(0, size).Sum(); Debug.Assert(libsum == answer); }
public ClassDisposeWrapper() { _handle = NativeLibBufferMethods.CreateLibBuffer(); // Determine if file is opened successfully. if (_handle.IsInvalid) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }
// if error, return false protected override bool ReleaseHandle() => (NativeLibBufferMethods.DisposeLibBuffer(handle) == 0);