If I have a method that checks the validity of its arguments, is it ok to throw my own custom exceptions derived from System.ArgumentException
? I am asking because ArgumentException
is itself derived from System.SystemException
and I am seeing conflicting guidelines as to whether an application should derive from SystemException
. (Albeit indirectly, deriving from ArgumentException
is still tantamount to deriving from SystemException
.)
I see lots of guidelines saying don't derive from ApplicationException
, but derive from Exception instead. I'm happy with that. What I'm not sure about is whether it's ok to derive from SystemException too.
If I shouldn't derive from SystemException
, then what should I derive my "invalid argument"
exception classes from?
question from:
https://stackoverflow.com/questions/12857708/is-it-ok-to-derive-from-system-argumentexception 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…