Why there is not exist method Convert.ToFloat(),C# has ToDouble(),ToDecimal()…
I want convert to float, which method can be used? (float)var?
Why there is not exist method Convert.ToFloat() ,C# has ToDouble() , ToDecimal() … I
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is – but it’s called
Convert.ToSingle().floatis a C# alias for theSystem.Singletype.“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 🙂 )