What should be passed as the objectName when throwing an ObjectDisposedException?

I believe the recommended practice is to throw the following:

throw new ObjectDisposedException(GetType().FullName);

Or including the check, these two lines of code at the top of each method that needs it (obviously not the Dispose method itself):

if (this.disposed)
    throw new ObjectDisposedException(GetType().FullName);

Might even be helpful to refactor this into a tiny method for usability.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)