Why there is not exist method Convert.ToFloat()
,C# has ToDouble()
,ToDecimal()
...
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 :) )
精彩评论