mscorlib(4.0.0.0) API with additions
XPathException.cs
1 using System.Resources;
4 
5 namespace System.Xml.XPath
6 {
10  {
11  private string res;
12 
13  private string[] args;
14 
15  private string message;
16 
19  public override string Message
20  {
21  get
22  {
23  if (message != null)
24  {
25  return message;
26  }
27  return base.Message;
28  }
29  }
30 
35  : base(info, context)
36  {
37  res = (string)info.GetValue("res", typeof(string));
38  args = (string[])info.GetValue("args", typeof(string[]));
39  string text = null;
40  SerializationInfoEnumerator enumerator = info.GetEnumerator();
41  while (enumerator.MoveNext())
42  {
43  SerializationEntry current = enumerator.Current;
44  if (current.Name == "version")
45  {
46  text = (string)current.Value;
47  }
48  }
49  if (text == null)
50  {
51  message = CreateMessage(res, args);
52  }
53  else
54  {
55  message = null;
56  }
57  }
58 
62  [SecurityPermission(SecurityAction.LinkDemand, SerializationFormatter = true)]
63  public override void GetObjectData(SerializationInfo info, StreamingContext context)
64  {
65  base.GetObjectData(info, context);
66  info.AddValue("res", res);
67  info.AddValue("args", args);
68  info.AddValue("version", "2.0");
69  }
70 
72  public XPathException()
73  : this(string.Empty, (Exception)null)
74  {
75  }
76 
79  public XPathException(string message)
80  : this(message, (Exception)null)
81  {
82  }
83 
87  public XPathException(string message, Exception innerException)
88  : this("Xml_UserException", new string[1]
89  {
90  message
91  }, innerException)
92  {
93  }
94 
95  internal static XPathException Create(string res)
96  {
97  return new XPathException(res, (string[])null);
98  }
99 
100  internal static XPathException Create(string res, string arg)
101  {
102  return new XPathException(res, new string[1]
103  {
104  arg
105  });
106  }
107 
108  internal static XPathException Create(string res, string arg, string arg2)
109  {
110  return new XPathException(res, new string[2]
111  {
112  arg,
113  arg2
114  });
115  }
116 
117  internal static XPathException Create(string res, string arg, Exception innerException)
118  {
119  return new XPathException(res, new string[1]
120  {
121  arg
122  }, innerException);
123  }
124 
125  private XPathException(string res, string[] args)
126  : this(res, args, null)
127  {
128  }
129 
130  private XPathException(string res, string[] args, Exception inner)
131  : base(CreateMessage(res, args), inner)
132  {
133  base.HResult = -2146231997;
134  this.res = res;
135  this.args = args;
136  }
137 
138  private static string CreateMessage(string res, string[] args)
139  {
140  try
141  {
142  string text = Res.GetString(res, args);
143  if (text == null)
144  {
145  text = "UNKNOWN(" + res + ")";
146  }
147  return text;
148  }
150  {
151  return "UNKNOWN(" + res + ")";
152  }
153  }
154  }
155 }
Describes a set of security permissions applied to code. This class cannot be inherited.
XPathException(string message, Exception innerException)
Initializes a new instance of the T:System.Xml.XPath.XPathException class using the specified excepti...
Serves as the base class for system exceptions namespace.
override void GetObjectData(SerializationInfo info, StreamingContext context)
Streams all the T:System.Xml.XPath.XPathException properties into the T:System.Runtime....
Definition: __Canon.cs:3
XPathException()
Initializes a new instance of the T:System.Xml.XPath.XPathException class.
override string Message
Gets the description of the error condition for this exception.
Describes the source and destination of a given serialized stream, and provides an additional caller-...
SecurityAction
Specifies the security actions that can be performed using declarative security.
XPathException(string message)
Initializes a new instance of the T:System.Xml.XPath.XPathException class with the specified exceptio...
Provides the exception thrown when an error occurs while processing an XPath expression.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
The exception that is thrown if the main assembly does not contain the resources for the neutral cult...
Exception()
Initializes a new instance of the T:System.Exception class.
Definition: Exception.cs:286
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.
Holds the value, T:System.Type, and name of a serialized object.
XPathException(SerializationInfo info, StreamingContext context)
Uses the information in the T:System.Runtime.Serialization.SerializationInfo and T:System....
Provides a formatter-friendly mechanism for parsing the data in T:System.Runtime.Serialization....
object Value
Gets the value contained in the object.
string Name
Gets the name of the object.
bool MoveNext()
Updates the enumerator to the next item.