L
Luigi Z
Hi all,
how can I get the absolute value of a decimal nullable value? (C# 2.0).
Thanks a lot.
how can I get the absolute value of a decimal nullable value? (C# 2.0).
Thanks a lot.
Luigi Z said:how can I get the absolute value of a decimal nullable value? (C# 2.0).
Alberto Poblacion said:You can add to your code a function for this purpose:
public decimal? Abs(decimal? d)
{
if (d.HasValue && d.Value<0) return -d.Value;
return d;
}
Luigi Z said:[...]
foreach (decimal? value in valuesList)
[...]
totalValue += value;
[...]
The problem is to round "value" in totalValue += value;
Have you idea?