LibUsbDotNet.Main.PinnedHandle.Dispose C# (CSharp) Method

Dispose() public method

Frees and disposes the GCHandle for this pinned object.
public Dispose ( ) : void
return void
        public void Dispose()
        {
            if ((mFreeGcBuffer) && mGcObject.IsAllocated)
            {
                mFreeGcBuffer = false;
                mGcObject.Free();
            }
            GC.SuppressFinalize(this);
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Cancels any pending transfer and frees resources.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (!mbDisposed)
            {
                mbDisposed = true;
                try
                {
                    if (!IsCancelled)
                    {
                        Cancel();
                    }

                    int dummy;
                    if (!mHasWaitBeenCalled)
                    {
                        Wait(out dummy);
                    }
                    if (disposing)
                    {
                        // Dispose managed resources.
                        if (mPinnedHandle != null)
                        {
                            mPinnedHandle.Dispose();
                        }
                    }
                    mPinnedHandle = null;
                }
                catch (Exception ex)
                {
                    Debug.Print(ex.Message);
                }
            }
        }
All Usage Examples Of LibUsbDotNet.Main.PinnedHandle::Dispose