Alex Rivera | Logout

What does BlockingCollection.Dispose actually do?

Asked 2010-07-06T17:21:44.420
10

What does BlockingCollection.Dispose actually do?

Edit
Report

2 Answers

4

Having a quick look with reflector reveals this...

protected virtual void Dispose(bool disposing)
{
    if (!this.m_isDisposed)
    {
        if (this.m_freeNodes != null)
        {
            this.m_freeNodes.Dispose();
        }
        this.m_occupiedNodes.Dispose();
        this.m_isDisposed = true;
    }
}

and m_freeNodes is private SemaphoreSlim m_freeNodes; so it releases the SemaphoreSlim that are used internally.

answered 2010-07-06T17:30:08.657
-9

Releases all resources used by the current instance of the BlockingCollection<T> class. (Source)

answered 2010-07-06T17:24:31.120

Your Answer