public static decimal?RoundMonetaryAmount(decimal?v, MonetaryAmountType amountType = MonetaryAmountType.NotSet) { if (v.HasValue) { return(RoundMonetaryAmount(v.Value, amountType)); } return(null); }
public static decimal RoundMonetaryAmount(decimal v, MonetaryAmountType amountType = MonetaryAmountType.NotSet) { int digits = 2; switch (amountType) { case MonetaryAmountType.MonetaryValue: digits = 4; break; } return(Math.Round(v, digits, MidpointRounding.AwayFromZero)); }