If I call AddMonths on a DateTime object using an int that is too large, I get an ArgumentException thrown in my face with a polite message that says,
“The added or subtracted value results in an un-representable DateTime.
Parameter name: months”
What check should I do on the months argument before calling this method?
From the MSDN:
Based on your comment I’d say that the resultant months value is greater than 120,000.
You could get total months in the current date time and check that that plus your value isn’t out of range, or catch the exception as others have suggested.