Is there a list of .Net Exception types and tips on when to use them?

Does anyone know a list of .Net types Exception.eg ArgumentNullException and under what circumstances should you use them? At the moment, I am just guessing based on the type name, but I would rather understand that.

+42
exception
Jul 13 '11 at 8:20
source share
1 answer

List of them:

http://mikevallotton.wordpress.com/2009/07/08/net-exceptions-all-of-them/

As for the circumstances, it depends on how many times they make sense, based on their name and arguments. ArgumentNullException , for example, is commonly used when checking method / constructor arguments for null values.

Then you have others, such as FileNotFoundException , NullReferenceException , InvalidOperationException , as you can see that they are read very easily and should be used with common sense.

Update 1: as someone suggested, they are also on MSDN:

http://msdn.microsoft.com/en-us/library/system.exception.aspx#inheritanceContinued

The following are the types of common exceptions available:

http://weblogs.asp.net/jgaylord/archive/2009/07/08/common-and-all-system-exceptions-in-net.aspx

http://www.developerfusion.com/article/1889/exception-handling-in-c/3/

Update 2: as for use, Microsoft has recommendations for reserved exception types:

http://msdn.microsoft.com/en-us/library/ms182338.aspx

+37
Jul 13 '11 at 8:24
source share



All Articles