Math.Round(new FileInfo(strFilePath).Length / 1024d, 1)
The problem is that you make an integer division (results also in an int
) and a int
can be implicitly converted to both double
and decimal
. Therefore, you need to make sure the expression results in one of those; double
is probably what you want.
Math.Round(new FileInfo(strFilePath).Length / 1024.0, 1)
Math.Round((double) (new FileInfo(strFilePath).Length / 1024), 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With