How to throw a custom exception? - DOT.NET

How to throw a custom exception?

The usual try - catch - finally - end try format has to be followed. However, in this case, instead of using the preset exceptions from the System.Exception, you define your OwnException class and inherit Exception or ApplicationException class.

You need to define three constructors in your OwnException Class: One without parameters, other with String parameter for error message and the last one has to have one parameter as a String and other as an Inner exception object.

class OwnException : ApplicationException
       public OwnException() : base() { }
       public OwnException(string s) : base(s) { }
       public OwnException(string s, Exception ae) : base(s, ae) { }
What is the difference between Localization and Globalization? - DOT.NET
In Globalization, an application is developed to support various languages and cultures.....
What is Unicode? - DOT.NET
Unicode is a 16-bit character encoding scheme that enables characters from various languages to be used...
What are resource file and how do we generate resource file? - DOT.NET
Resource files are used to separate the implementation of the application from its User Interface....
Post your comment