S
Sam Sungshik Kong
Hello!
Here's a simple class.
class C
{
public int Num;
public C(int i)
{
Num = i;
}
public C(string s): this(int.Parse(s))
{
}
}
When I create an object..
C o = new C("1"); //this is ok.
C o = new C("a"); //this causes an error, of course.
I want to have some exception handling mechanism for the argument validation
in the class.
What's the common practice for such a situation?
Thanks.
Sam
Here's a simple class.
class C
{
public int Num;
public C(int i)
{
Num = i;
}
public C(string s): this(int.Parse(s))
{
}
}
When I create an object..
C o = new C("1"); //this is ok.
C o = new C("a"); //this causes an error, of course.
I want to have some exception handling mechanism for the argument validation
in the class.
What's the common practice for such a situation?
Thanks.
Sam