C# – How to create a custom exception
To create a custom exception, create a subclass of the Exception class, like this: Then throw it just like you would any other exception, like this: It’s a good idea to call the base constructor from your constructor and pass in your custom error message. If this exception is unhandled, or if you are logging … Read more