C
Claire
My descendent constructor takes a string and an integer as parameters.
I'd like to format the message string before passing it to it's parent class
but it looks as though base(message,ErrorCode) has to be called too early.
Is this possible please?
Parent constructor
public class CommException : System.ApplicationException
{
public UInt32 m_nErrorCode;
public CommException(string message, UInt32 ErrorCode):
base(message)
{
m_nErrorCode = ErrorCode;
}
}
Descendent constructor
public LastErrorException(string message, UInt32 ErrorCode):
base(message,ErrorCode)<< original call
{
String str;
str = String.Format("File system reported error %d while %s",
(UInt32)ErrorCode, (String)message);
base(str,ErrorCode); <<<< doesn't compile
}
I'd like to format the message string before passing it to it's parent class
but it looks as though base(message,ErrorCode) has to be called too early.
Is this possible please?
Parent constructor
public class CommException : System.ApplicationException
{
public UInt32 m_nErrorCode;
public CommException(string message, UInt32 ErrorCode):
base(message)
{
m_nErrorCode = ErrorCode;
}
}
Descendent constructor
public LastErrorException(string message, UInt32 ErrorCode):
base(message,ErrorCode)<< original call
{
String str;
str = String.Format("File system reported error %d while %s",
(UInt32)ErrorCode, (String)message);
base(str,ErrorCode); <<<< doesn't compile
}