technology

disposing: “You keep using that word. I do not think it means what you think it means.”

Something notable that I have learned so far is that the disposing boolean parameter for the IDisposable.Dispose(bool disposing) override does not answer the question: “Are we in the process of disposing?” Rather, it indicates how the method was called:

Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user’s code. Managed and unmanaged resources can be disposed. If disposing equals false, the method has been called by the  runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.

Advertisements
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s