Monday, December 18, 2017

Convert.ToInt32 in C#


Convert.ToInt32 method is used to convert the given string to its 32-bit signed integer. It will return 0 in case if string is null, rather it does not throw ArgumentNullException.

Syntax:
Convert.ToInt32(string str);

str is Input string.
Return Value: A 32-bit signed integer equivalent to “str”.

If the conversion is successful, then given string is converted into its 32-bit signed integer.


Exception:
Exception
Condition
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: