Owin.Host.MonoHttpListener.RequestProcessing.OwinHttpListenerContext.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( bool disposing ) : void
disposing bool
return void
        public virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                try
                {
                    _disconnectRegistration.Dispose();
                }
                catch (ObjectDisposedException)
                {
                    // CTR.Dispose() may throw an ODE on 4.0 if the CTS has previously been disposed.  Removed in 4.5.
                }
                if (_cts != null)
                {
                    _cts.Dispose();
                }
            }
        }

Same methods

OwinHttpListenerContext::Dispose ( ) : void

Usage Example

 private void EndRequest(OwinHttpListenerContext owinContext, Exception ex)
 {
     // TODO: Log the exception, if any
     Interlocked.Decrement(ref _currentOutstandingRequests);
     if (owinContext != null)
     {
         owinContext.End(ex);
         owinContext.Dispose();
     }
     // Make sure we start the next request on a new thread, need to prevent stack overflows.
     OffloadStartNextRequest();
 }