calling base constructor

T

Thana at Thailand

Thanks Peter Duniho,

Your solution is impressed me. I never thought about it before.

So, your solution is to use child class constructor argument in the same
format as the base class constructor argument to avoid complex
processing of argument.

Then use a static method (as factory) that parse the complex argument to
simple arguments and use that to create child class instead.

quote said:
class MyException : Exception
{
public MyException(string severity, string errCode, string message)
: base(message)
{
this.severity = severity;
this.errCode = errCode;
}

public static MyException FromFullMessage(string fullMsg)
{
// split string here, then...
return new MyException(severity, errCode, message);
}
}

This solution relieves me very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top