If I have the code:
Dim x as Decimal = 100.0m
Is it casting from a double to a decimal implicitly. How would I do this explicitly in vb.net?
I think you want:
Dim x as Decimal = 100.0d
The decimal literal in C# is m
, but is d
in vb.net. This produces no casting whatsoever. To cast a double to a decimal (r
is the double literal in vb.net) you could say:
Dim x as Decimal = CType(100r, Decimal)
Dim x as Decimal = CType(100.0, Decimal)
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