diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-07-25 02:00:43 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-07-25 02:00:43 +0400 |
commit | 36fd3b3b6d236de62d9080aae375b482552a79fc (patch) | |
tree | a43d87f4dc7e2a7d68f927f910eb6d17dc4c30c6 /mcs/class/corlib/System/TypeLoadException.cs | |
parent | d1953a2de00f6102aafc6e4f3f66c717ce24f40a (diff) |
2003-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* TypeLoadException.cs: removed unused fields. TypeName returns "" if
cannot even get the type.
svn path=/trunk/mcs/; revision=16628
Diffstat (limited to 'mcs/class/corlib/System/TypeLoadException.cs')
-rw-r--r-- | mcs/class/corlib/System/TypeLoadException.cs | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/mcs/class/corlib/System/TypeLoadException.cs b/mcs/class/corlib/System/TypeLoadException.cs index 56e30d48d16..01c844b19cc 100644 --- a/mcs/class/corlib/System/TypeLoadException.cs +++ b/mcs/class/corlib/System/TypeLoadException.cs @@ -20,28 +20,20 @@ namespace System { private string msg; private string type; - private string ClassName; - private string AssemblyName; - private string MessageArg; - private string ResourceID; - // Constructors public TypeLoadException () : base (Locale.GetText ("A type load exception has occurred.")) { - msg = Locale.GetText ("A type load exception has occured."); } public TypeLoadException (string message) : base (message) { - msg = message; } public TypeLoadException (string message, Exception inner) : base (message, inner) { - msg = message; } protected TypeLoadException (SerializationInfo info, StreamingContext context) @@ -50,21 +42,29 @@ namespace System { if (info == null) throw new ArgumentNullException ("info is null."); - ClassName = info.GetString ("TypeLoadClassName"); - AssemblyName = info.GetString ("TypeLoadAssemblyName"); - MessageArg = info.GetString ("MessageArg"); - ResourceID = info.GetString ("ResourceID"); + type = info.GetString ("type"); } // Properties - public override string Message - { - get { return msg; } + public override string Message { + get { + if (type == null) + return base.Message; + + if (msg == null) + msg = "Cannot load type '" + type + "'"; + + return msg; + } } - public string TypeName - { - get { return type; } + public string TypeName { + get { + if (type == null) + return ""; + + return type; + } } // Methods @@ -74,10 +74,7 @@ namespace System { throw new ArgumentNullException ("info is null."); base.GetObjectData (info, context); - info.AddValue ("TypeLoadClassName", ClassName, typeof (string)); - info.AddValue ("TypeLoadAssemblyName", AssemblyName, typeof (string)); - info.AddValue ("TypeLoadMessageArg", MessageArg, typeof (string)); - info.AddValue ("TypeLoadResourceID", ResourceID); + info.AddValue ("type", type, typeof (string)); } } } |