Converts a specified string to an Int16 in the specified base.
[Visual Basic] Overridable Public Function ToInt16() As Short [C#] public virtual short ToInt16(); [C++] public: virtual short ToInt16(); [JScript] public function ToInt16() : Int16;
The Int16 representation of value as a base number .
Exception Type | Condition |
---|---|
ArgumentException | If the string is not base 2, 8, 10, or 16. |
ArgumentException | If the string is null. |
FormatException | If the string cannot be parsed as a base number or the value represented is greater than Int16.MaxValue or less than Int16.MinValue. |
If the string is 16, the number may be preceded by "0x"; any other leading or trailing characters cause an error.
The ToInt16 implementation is the same as ToInt16. (In addition information, see Int16, Convert and Value.)