Define an exception type in C#
Forums:
class SimpleException: Exception { }
class RecommendExc: Exception {
//recommended constructors
public RecommendExc () { }
public RecommendExc(string message) : base( message ) { }
public RecommendExc(string message, Exception inner) : base ( message, inner ) { }
protected RecommendExc(SerializationInfo info, StreamingContext context): base ( info, context ) { }
//... any other members
}
throw new SimpleException();
throw new RecommendExc("exeption");
- Log in to post comments