Saturday, December 16, 2017

int.Parse() in C#


int.Parse method is used to convert given string to its 32-bit signed integer value. It is available in “System” namespace. It takes string as a parameter to convert it into integer value however exception is thrown if the string in the parameter is not numeric.

Syntax:

int.Parse(string str);
 
str is Input string.
Return Value: A 32-bit signed integer 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 -2,147,483,648 and 2,147,483,647
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: