Reputation: 47743
Never needed to do this before till now.
trying to make sure the chargeAmount (which is type decimal) does not go below 1 cent:
if (chargeAmount < 0.01)
throw new ArgumentOutOfRangeException("chargeAmount");
I tried 0.01D but obviously I am not sure how you format this.
Upvotes: 2
Views: 3489
Reputation: 499002
A decimal literal does not use D
(that's for Double) - it uses M
(for Money):
if (chargeAmount < 0.01M)
throw new ArgumentOutOfRangeException("chargeAmount");
Upvotes: 3
Reputation: 113272
You mean you want it to be a decimal literal rather than double?
if (chargeAmount < 0.01m)
Upvotes: 12