ObjectDisposedException
ObjectDisposedException
typically indicates a bug in your program. Types implementing the IDisposable
interface throw an exception of this type to signal use of the object after it has been disposed (for example, by use of a using
statement):
Correct use of the using
statement will prevent use of the acquired resource after the block has been left. The preceding exception wouldn’t have been possible if the code had been written as follows instead:
This is because the using
statement used here was turned into the following ...
Get C# 4.0 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.