C# Convert ToInt32(String)
Description
Convert ToInt32(String)
converts the specified string
representation of a number to an equivalent 32-bit signed integer.
Syntax
Convert.ToInt32(String)
has the following syntax.
public static int ToInt32(
string value
)
Parameters
Convert.ToInt32(String)
has the following parameters.
value
- A string that contains the number to convert.
Returns
Convert.ToInt32(String)
method returns A 32-bit signed integer that is equivalent to the number in value, or 0 (zero)
if value is null.
Example
//from w w w . j av a2s . com
using System;
public class MainClass{
public static void Main(String[] argv){
Console.WriteLine(Convert.ToInt32("123"));
}
}
The code above generates the following result.