custom Exception class

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hi!

I just wonder if I will create an custom exception class which of these two
alternatives is it best to use.

public class TeamListFilledException : ApplicationException
or
public class TeamListFilledException : Exception

Tony
 
I just wonder if I will create an custom exception class which of these two
alternatives is it best to use.

public class TeamListFilledException : ApplicationException
or
public class TeamListFilledException : Exception

MS's point of view in docs is:

<quote>
For most applications, derive custom exceptions from the Exception
class. It was originally thought that custom exceptions should derive
from the ApplicationException class; however in practice this has not
been found to add significant value.
</quote>

Source:
http://msdn.microsoft.com/en-us/library/system.applicationexception.aspx
http://msdn.microsoft.com/en-us/library/seyhszts.aspx

So once upon a time MS preferred the first, but today they prefer the
last.

So I suggest that you go for the last!

Arne
 
Back
Top