There are three standard argument exceptions in .Net:
- ArgumentException
- ArgumentNullException
- ArgumentOutOfRangeException
They all have overloads on their constructors so that you can indicate which argument was the problem, and a more detailed message when throwing them.
It would be common practice to use them.
Edit:
In addition to the null (or empty or other) permissible, I still tend to throw an exception, since you do not necessarily know what your library user will work with. If they don't mind zeros, they can always catch the exception and handle it accordingly.
However, if you did not select an exception, you are limited in your ability to tell the consumer of your library what the problem is.
source share