When implementing IDisposable, I undertand that every method that shouldn’t be called after the object’s been disposed should throw the ObjectDisposedException. But what is the standard for the name object that should be passed to the exception’s constructor?
When implementing IDisposable, I undertand that every method that shouldn’t be called after the
Share
I believe the recommended practice is to throw the following:
Or including the check, these two lines of code at the top of each method that needs it (obviously not the
Disposemethod itself):Might even be helpful to refactor this into a tiny method for usability.