Int Numval = convert. toint32 ( " 29 " );
Numval ++;
Console. writeline (numval );
//Output: 30
========================================================== ==========
IntNumval = int32.parse ("-105");
Console. writeline (numval );
//Output:-1, 105
========================================================== ============
IntJ;
Int32.tryparse ("-105",OutJ );
Console. writeline (j );
//Output:-1, 105
========================================================== ============
Try
{
IntM = int32.parse ("ABC");
}
Catch(Formatexception E)
{
Console. writeline (E. Message );
}
//Output: input string was not in a correct format.
========================================================== ==============
StringInputstring ="ABC";
IntNumvalue;
BoolParsed = int32.tryparse (inputstring,OutNumvalue );
If(! Parsed)
Console. writeline ("Int32.tryparse cocould not parse '{0}' to an int. \ n", Inputstring );
//Output: int32.tryparse cocould not parse 'abc' to an int.