custom Exception class

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
 
A

Arne Vajhøj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top