2 // System.ObjectDisposedException.cs
5 // Paolo Molaro (lupus@ximian.com)
6 // Duncan Mak (duncan@ximian.com)
8 // (C) 2001 Ximian, Inc. http://www.ximian.com
11 using System.Runtime.Serialization;
16 public class ObjectDisposedException : InvalidOperationException
18 // Does not override the HResult from InvalidOperationException
20 private string obj_name;
24 public ObjectDisposedException (string objectName)
25 : base (Locale.GetText ("The object was used after being disposed."))
27 obj_name = objectName;
28 msg = Locale.GetText ("The object was used after being disposed.");
31 public ObjectDisposedException (string objectName, string message)
34 obj_name = objectName;
38 protected ObjectDisposedException (SerializationInfo info, StreamingContext context)
39 : base (info, context)
41 obj_name = info.GetString ("ObjectName");
45 public override string Message {
49 public string ObjectName {
50 get { return obj_name; }
53 public override void GetObjectData (SerializationInfo info, StreamingContext context)
55 base.GetObjectData (info, context);
56 info.AddValue ("ObjectName", obj_name);