O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

ObjectDisposedException

Synopsis

This exception is thrown when certain operations are performed on an object that has been disposed. For example, trying to read from an I/O stream that has been closed by the System.IO.Stream.Close() method should raise this exception.

public class ObjectDisposedException : InvalidOperationException {
// Public Constructors
   public method ObjectDisposedException(string objectName);  
   public method ObjectDisposedException(string objectName, 
        string message);  
// Protected Constructors
   protected method ObjectDisposedException(
        System.Runtime.Serialization.SerializationInfo info, 
        System.Runtime.Serialization.StreamingContext context);  
// Public Instance Properties
   public override field string Message{get; }                   // overrides Exception
   public field string ObjectName{get; } 
// Public Instance Methods
   public override method void GetObjectData(                   // overrides Exception
        System.Runtime.Serialization.SerializationInfo info, 
        System.Runtime.Serialization.StreamingContext context);  
}

Hierarchy

ObjectException(System.Runtime.Serialization.ISerializable)SystemExceptionInvalidOperationExceptionObjectDisposedException

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required