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