I'm in .NET (C#), and I have a piece of code that basically does the following:
decimal value = decimal.Parse(s);
long result = (long)(value * 10000M);
However, I can't use 10000
directly since the number of decimal places is variable (in this case, it's stored as 4
). Is there a way I can use this 4
to get to 10000M
?
I was thinking on something like Math.Pow
, but it doesn't seem to be available for decimal types. I was also thinking on a simple function that does multiplication in a loop, but if something already exists in the .NET framework, then I'd rather use that.