Tuesday, January 21, 2014

A custom exception class with Log flag

A class to re-thrown Exception with property if the Exception is already logged.

[Serializable()] public class ExceptionLog : Exception { private bool isLogged; public bool IsLogged { get { return isLogged; } } protected ExceptionLog() : base() { } public ExceptionLog(bool value) : base() { isLogged = value; } public ExceptionLog(bool value, string message) : base(message) { isLogged = value; } public ExceptionLog(bool value , string message , Exception innerException) : base(message, innerException) { isLogged = value; } protected ExceptionLog(SerializationInfo info , StreamingContext context) : base(info, context) { } }

Share/Bookmark

No comments: