开发者

C#: Multiply Decimal with Float?

I want开发者_如何学C to perform the following operation:

decimal = decimal? * float / 100

What's the most efficient way to do this?


Do you want the result as a float

var result = ((float)d) * f / 100;

or as a decimal

var result = d * ((decimal)f) / 100;

I certainly question the mixing of decimal and float types though. Some context would help!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜