mscorlib(4.0.0.0) API with additions
ObjectDisposedException.cs
3 using System.Security;
4 
5 namespace System
6 {
9  [ComVisible(true)]
10  [__DynamicallyInvokable]
12  {
13  private string objectName;
14 
17  [__DynamicallyInvokable]
18  public override string Message
19  {
20  [__DynamicallyInvokable]
21  get
22  {
23  string text = ObjectName;
24  if (text == null || text.Length == 0)
25  {
26  return base.Message;
27  }
28  string resourceString = Environment.GetResourceString("ObjectDisposed_ObjectName_Name", text);
29  return base.Message + Environment.NewLine + resourceString;
30  }
31  }
32 
35  [__DynamicallyInvokable]
36  public string ObjectName
37  {
38  [__DynamicallyInvokable]
39  get
40  {
41  if (objectName == null && !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
42  {
43  return string.Empty;
44  }
45  return objectName;
46  }
47  }
48 
49  private ObjectDisposedException()
50  : this(null, Environment.GetResourceString("ObjectDisposed_Generic"))
51  {
52  }
53 
56  [__DynamicallyInvokable]
57  public ObjectDisposedException(string objectName)
58  : this(objectName, Environment.GetResourceString("ObjectDisposed_Generic"))
59  {
60  }
61 
65  [__DynamicallyInvokable]
66  public ObjectDisposedException(string objectName, string message)
67  : base(message)
68  {
69  SetErrorCode(-2146232798);
70  this.objectName = objectName;
71  }
72 
76  [__DynamicallyInvokable]
77  public ObjectDisposedException(string message, Exception innerException)
78  : base(message, innerException)
79  {
80  SetErrorCode(-2146232798);
81  }
82 
87  : base(info, context)
88  {
89  objectName = info.GetString("ObjectName");
90  }
91 
95  [SecurityCritical]
96  public override void GetObjectData(SerializationInfo info, StreamingContext context)
97  {
98  base.GetObjectData(info, context);
99  info.AddValue("ObjectName", ObjectName, typeof(string));
100  }
101  }
102 }
static string NewLine
Gets the newline string defined for this environment.
Definition: Environment.cs:449
Definition: __Canon.cs:3
ObjectDisposedException(string objectName)
Initializes a new instance of the T:System.ObjectDisposedException class with a string containing the...
override void GetObjectData(SerializationInfo info, StreamingContext context)
Retrieves the T:System.Runtime.Serialization.SerializationInfo object with the parameter name and add...
Describes the source and destination of a given serialized stream, and provides an additional caller-...
The exception that is thrown when an operation is performed on a disposed object.
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
ObjectDisposedException(SerializationInfo info, StreamingContext context)
Initializes a new instance of the T:System.ObjectDisposedException class with serialized data.
ObjectDisposedException(string message, Exception innerException)
Initializes a new instance of the T:System.ObjectDisposedException class with a specified error messa...
string ObjectName
Gets the name of the disposed object.
ObjectDisposedException(string objectName, string message)
Initializes a new instance of the T:System.ObjectDisposedException class with the specified object na...
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
override string Message
Gets the message that describes the error.
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
Definition: Exception.cs:22
Specifies that the class can be serialized.
The exception that is thrown when a method call is invalid for the object's current state.