What should be passed as the objectName when throwing an ObjectDisposedException?
问题 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? 回答1: 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