Hi,
Message is a read only property, you cannot change it, and you dont have
access to the member variable.
What you can do is override Message property. just add a string variable
that you build with your hashtable and modify Message as described.
The bad thing about this is in a catch(Exception ) you will not get your
custom message, but the Exception's generated one, to access your youwill
need to catch ( MyException )
Maybe somebody can explain why MS does not allow access to the variable
instance ( if any exist ) that make up Message property.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Rasmus" <Ra****@nospam.nospam> wrote in message
news:7A**********************************@microsof t.com...
I need to set the exception message on an already constructed Exception.
Is there a way to accomplish this?
Psudo Code:
public class MyException : Exception {
public MyException (Hashtable myData) : base ("dummy") {
foreach (string sTemp in myData.Keys){
this.Message += "," + sTemp;
}
}
}
USE LIKE THIS :
Hashtable myData = new Hashtable();
myData.Add("car",4);
myData.Add("truck",6);
throw new MyException(myData);