2002-08-21 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / class / corlib / System / ObjectDisposedException.cs
index c4ad249b4d097b9af2d6cd984b1d0129cb5e23ea..b1e390aa5be95b08167384a7ffb23e9dd72408e2 100755 (executable)
@@ -3,27 +3,58 @@
 //
 // Author:
 //   Paolo Molaro (lupus@ximian.com)
+//   Duncan Mak (duncan@ximian.com)
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+using System.Globalization;
+using System.Runtime.Serialization;
+
 namespace System {
 
+       [Serializable]
        public class ObjectDisposedException : InvalidOperationException {
                private string obj_name;
-               // Constructors
+               private string msg;
 
+                // Constructors
                public ObjectDisposedException (string objectName)
-                       : base ("The object was used after being disposed")
+                       : base (Locale.GetText ("The object was used after being disposed"))
                {
                        obj_name = objectName;
+                       msg = Locale.GetText ("The object was used after being disposed");
                }
-               public ObjectDisposedException( string objectName, string message) 
+
+               public ObjectDisposedException (string objectName, string message) 
                        : base (message)
                {
                        obj_name = objectName;
+                       msg = message;
+               }
+
+               protected ObjectDisposedException (SerializationInfo info, StreamingContext context)
+                       : base (info, context)
+               {
+                       obj_name = info.GetString ("ObjectName");
+               }
+
+               // Properties
+               public override string Message
+               {
+                       get { return msg; }
                }
 
+               public string ObjectName
+               {
+                       get { return obj_name; }
+               }
 
+               
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("ObjectName", obj_name);
+               }
        }
 }