Tuesday, December 19, 2017

float.Parse in C#


float.Parse method is used to convert given string to its single-precision floating-point number. It is available in “System” namespace. It takes string as a parameter to convert it into floating value however exception is thrown if the string in the parameter is not numeric.

Syntax:
float.Parse(string str);

str is Input string.
Return Value: single-precision floating-point number equivalent to “str”.



Exceptions:

Exception
Condition
ArgumentNullException
when str is null.
FormatException
when str is not in the correct format (may be some string value).
OverflowException
when str is not in range of 3.402823e38 and 3.40282347E+38.



Share This
Previous Post
Next Post

TekGrabs, established in 2017, is in the business of sharing Information. It provides news, articles and photos about the different technologies, inventions in different domains. Provides information on programming and databases.

0 comments: