I have a decimal variable. I'd like it to store a number rounded to
two decimal places.
I've declared and loaded it like this:
CODE
private Decimal FileSize_MB_DataFile = 0.0M;
this.FileSize_MB_InitialFile = Convert.ToDecimal(fileInfo.Length) /
1048576; //1024 x 1024
I want the actual value of the variable to be, for example, .75 or
15.28 or whatever (I don't want to convert it to a string and format
it unless that's strictly necessary). When I look at the value of the
variable in the debugger it goes out to like 15 decimal places. I'm
sure this is quite simple.
I realize I could keep the precision but these values are going into a
database and I don't want/need the extra digits.
Thanks.