What exceptions should be thrown for invalid or unexpected parameters in .NET?
Asked 07 September, 2021
Viewed 1.6K times
  • 58
Votes

What types of exceptions should be thrown for invalid or unexpected parameters in .NET? When would I choose one instead of another?

Follow-up:

Which exception would you use if you have a function expecting an integer corresponding to a month and you passed in '42'? Would this fall into the "out of range" category even though it's not a collection?

7 Answer