mscorlib(4.0.0.0) API with additions
ArgumentOutOfRangeException.cs
3 using System.Security;
4 
5 namespace System
6 {
9  [ComVisible(true)]
10  [__DynamicallyInvokable]
12  {
13  private static volatile string _rangeMessage;
14 
15  private object m_actualValue;
16 
17  private static string RangeMessage
18  {
19  get
20  {
21  if (_rangeMessage == null)
22  {
23  _rangeMessage = Environment.GetResourceString("Arg_ArgumentOutOfRangeException");
24  }
25  return _rangeMessage;
26  }
27  }
28 
31  [__DynamicallyInvokable]
32  public override string Message
33  {
34  [__DynamicallyInvokable]
35  get
36  {
37  string message = base.Message;
38  if (m_actualValue != null)
39  {
40  string resourceString = Environment.GetResourceString("ArgumentOutOfRange_ActualValue", m_actualValue.ToString());
41  if (message == null)
42  {
43  return resourceString;
44  }
45  return message + Environment.NewLine + resourceString;
46  }
47  return message;
48  }
49  }
50 
53  [__DynamicallyInvokable]
54  public virtual object ActualValue
55  {
56  [__DynamicallyInvokable]
57  get
58  {
59  return m_actualValue;
60  }
61  }
62 
64  [__DynamicallyInvokable]
66  : base(RangeMessage)
67  {
68  SetErrorCode(-2146233086);
69  }
70 
73  [__DynamicallyInvokable]
74  public ArgumentOutOfRangeException(string paramName)
75  : base(RangeMessage, paramName)
76  {
77  SetErrorCode(-2146233086);
78  }
79 
83  [__DynamicallyInvokable]
84  public ArgumentOutOfRangeException(string paramName, string message)
85  : base(message, paramName)
86  {
87  SetErrorCode(-2146233086);
88  }
89 
93  [__DynamicallyInvokable]
94  public ArgumentOutOfRangeException(string message, Exception innerException)
95  : base(message, innerException)
96  {
97  SetErrorCode(-2146233086);
98  }
99 
104  [__DynamicallyInvokable]
105  public ArgumentOutOfRangeException(string paramName, object actualValue, string message)
106  : base(message, paramName)
107  {
108  m_actualValue = actualValue;
109  SetErrorCode(-2146233086);
110  }
111 
116  [SecurityCritical]
117  public override void GetObjectData(SerializationInfo info, StreamingContext context)
118  {
119  if (info == null)
120  {
121  throw new ArgumentNullException("info");
122  }
123  base.GetObjectData(info, context);
124  info.AddValue("ActualValue", m_actualValue, typeof(object));
125  }
126 
131  : base(info, context)
132  {
133  m_actualValue = info.GetValue("ActualValue", typeof(object));
134  }
135  }
136 }
static string NewLine
Gets the newline string defined for this environment.
Definition: Environment.cs:449
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
ArgumentOutOfRangeException()
Initializes a new instance of the T:System.ArgumentOutOfRangeException class.
ArgumentOutOfRangeException(SerializationInfo info, StreamingContext context)
Initializes a new instance of the T:System.ArgumentOutOfRangeException class with serialized data.
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
ArgumentOutOfRangeException(string paramName, string message)
Initializes a new instance of the T:System.ArgumentOutOfRangeException class with the name of the par...
Describes the source and destination of a given serialized stream, and provides an additional caller-...
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
override string Message
Gets the error message and the string representation of the invalid argument value,...
virtual object ActualValue
Gets the argument value that causes this exception.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
The exception that is thrown when one of the arguments provided to a method is not valid.
ArgumentOutOfRangeException(string paramName)
Initializes a new instance of the T:System.ArgumentOutOfRangeException class with the name of the par...
ArgumentOutOfRangeException(string paramName, object actualValue, string message)
Initializes a new instance of the T:System.ArgumentOutOfRangeException class with the parameter name,...
Allows an object to control its own serialization and deserialization.
Definition: ISerializable.cs:8
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
Definition: Exception.cs:22
ArgumentOutOfRangeException(string message, Exception innerException)
Initializes a new instance of the T:System.ArgumentOutOfRangeException class with a specified error m...
Specifies that the class can be serialized.
override void GetObjectData(SerializationInfo info, StreamingContext context)
Sets the T:System.Runtime.Serialization.SerializationInfo object with the invalid argument value and ...