Converts a String to an Int16.
[Visual Basic] Overloads Public Shared Function ToInt16( _ ByVal value As String _ ) As Short [C#] public static short ToInt16( string value ); [C++] public: static short ToInt16( String* value ); [JScript] public static function ToInt16( value : String ) : Int16;
An Int16 with the value represented by value.
Exception Type | Condition |
---|---|
ArgumentException | Iif value is null. |
FormatException | Is thrown if value cannot be parsed or the value represented is greater than Int16.MaxValue or less than Int16.MinValue. |
OverflowException | If value represents a number that is less than Int16.MinValue or greater than Int16.MaxValue. Note that if the beginning of the string value contains a properly formatted numerical value that will result in an overflow and, in addition, the end of the string is improperly formed, it cannot be determined whether an OverflowException or a FormatException will be thrown. This has been implemented this way for performance reasons. |
Default String to Integer Parsing. value is parsed as a decimal unless it is preceded by 0x, in which case it is parsed a hexadecimal number. White space or trailing characters will cause a FormatException.
Convert Class | Convert Members | System Namespace | Convert.ToInt16 Overload List