using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CustomComponents.Exceptions { public class ContentException : Exception { public ContentException(bool state) : base(CustomMessage(state)){ } private static string CustomMessage(bool state) { if(state) { return "TextBox is not empty however null flag is checked."; } return "TextBox is empty. You better write something!"; } } }