You didn't provide a whole lot of info, but here's one idea.
You use Nullable Types (types that end with a ?
), but don't seem to actually check if they are null. (There might be code you omitted). If you know they won't be null, don't use nullable types. That will get rid of all the .Value
terms in your expression.
This would change your expression to:
total = (decimal)Math.Ceiling((double)quantity * (double)days * (double)multiplier);
I don't know why you're casting each multiplier to double
. I'd prefer multiplying them all together before casting to double
. (check carefully for loss of precision.)
This would change your expression to:
total = (decimal)Math.Ceiling((double)(quantity * days * multiplier));
Overall, that looks simpler to me, and should be just as good.
(only testing will tell for sure!)