I want to access the protected member hresult of the Exception class, so I
derived my own class from ApplicationException and SystemException.
public class LoggedException : SystemException
{
public LoggedException() : base()
{
}
public LoggedException(String message) : base (message)
{
}
public LoggedException(String message, Exception objInner) : base(message,
objInner)
{
}
public LoggedException(SerializationInfo srlInfo, StreamingContext
strmCntxt) : base(srlInfo, strmCntxt)
{
}
}
Now , I write the following code that raises SystemException, where obj is
still not allocated.Now my question is why it doesn't get caught in my catch
block, when my class is derived from SystemException.I have tried deriving
from Exception base class, but no use.How should I go about it, if I want to
access the protected member hresult of the exception class.
try
{
obj.GetType()
}
catch(LoggedException e)
{
//...........
}