mscorlib(4.0.0.0) API with additions
ArgumentException.cs
3 using System.Security;
4 
5 namespace System
6 {
9  [ComVisible(true)]
10  [__DynamicallyInvokable]
12  {
13  private string m_paramName;
14 
17  [__DynamicallyInvokable]
18  public override string Message
19  {
20  [__DynamicallyInvokable]
21  get
22  {
23  string message = base.Message;
24  if (!string.IsNullOrEmpty(m_paramName))
25  {
26  string resourceString = Environment.GetResourceString("Arg_ParamName_Name", m_paramName);
27  return message + Environment.NewLine + resourceString;
28  }
29  return message;
30  }
31  }
32 
35  [__DynamicallyInvokable]
36  public virtual string ParamName
37  {
38  [__DynamicallyInvokable]
39  get
40  {
41  return m_paramName;
42  }
43  }
44 
46  [__DynamicallyInvokable]
48  : base(Environment.GetResourceString("Arg_ArgumentException"))
49  {
50  SetErrorCode(-2147024809);
51  }
52 
55  [__DynamicallyInvokable]
56  public ArgumentException(string message)
57  : base(message)
58  {
59  SetErrorCode(-2147024809);
60  }
61 
65  [__DynamicallyInvokable]
66  public ArgumentException(string message, Exception innerException)
67  : base(message, innerException)
68  {
69  SetErrorCode(-2147024809);
70  }
71 
76  [__DynamicallyInvokable]
77  public ArgumentException(string message, string paramName, Exception innerException)
78  : base(message, innerException)
79  {
80  m_paramName = paramName;
81  SetErrorCode(-2147024809);
82  }
83 
87  [__DynamicallyInvokable]
88  public ArgumentException(string message, string paramName)
89  : base(message)
90  {
91  m_paramName = paramName;
92  SetErrorCode(-2147024809);
93  }
94 
99  : base(info, context)
100  {
101  m_paramName = info.GetString("ParamName");
102  }
103 
108  [SecurityCritical]
109  public override void GetObjectData(SerializationInfo info, StreamingContext context)
110  {
111  if (info == null)
112  {
113  throw new ArgumentNullException("info");
114  }
115  base.GetObjectData(info, context);
116  info.AddValue("ParamName", m_paramName, typeof(string));
117  }
118  }
119 }
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...
Serves as the base class for system exceptions namespace.
override void GetObjectData(SerializationInfo info, StreamingContext context)
Sets the T:System.Runtime.Serialization.SerializationInfo object with the parameter name and addition...
Definition: __Canon.cs:3
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
virtual string ParamName
Gets the name of the parameter that causes this exception.
ArgumentException(SerializationInfo info, StreamingContext context)
Initializes a new instance of the T:System.ArgumentException class with serialized data.
ArgumentException()
Initializes a new instance of the T:System.ArgumentException class.
override string Message
Gets the error message and the parameter name, or only the error message if no parameter name is set.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
ArgumentException(string message, string paramName, Exception innerException)
Initializes a new instance of the T:System.ArgumentException class with a specified error message,...
The exception that is thrown when one of the arguments provided to a method is not valid.
ArgumentException(string message, Exception innerException)
Initializes a new instance of the T:System.ArgumentException class with a specified error message and...
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
ArgumentException(string message)
Initializes a new instance of the T:System.ArgumentException class with a specified error message.
Specifies that the class can be serialized.
ArgumentException(string message, string paramName)
Initializes a new instance of the T:System.ArgumentException class with a specified error message and...