开发者

Why is there no Convert.toFloat() method?

Why there is not exist method Convert.ToFloat(),C# has ToDouble(),ToDecimal()...

I want convert to f开发者_运维百科loat, which method can be used? (float)var?


There is - but it's called Convert.ToSingle(). float is a C# alias for the System.Single type.

"Single" is the name for a float in the BCL. "float" is an alias provided by C#. There's a Convert.ToSingle() method, just like there's Convert.ToInt32() instead of Convert.ToInt().

See this thread Convert class

(BTW - I didn't know this either, so I learned something new today :) )

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜