Convert.ToUInt16 Method (String, Int32)
Assembly: mscorlib (in mscorlib.dll)
/** @attribute CLSCompliantAttribute(false) */ public static UInt16 ToUInt16 ( String value, int fromBase )
CLSCompliantAttribute(false) public static function ToUInt16 ( value : String, fromBase : int ) : ushort
Parameters
- value
A String containing a number.
- fromBase
The base of the number in value, which must be 2, 8, 10, or 16.
Return Value
A 16-bit unsigned integer equivalent to the number in value. -or- Zero if value is a null reference (Nothing in Visual Basic).| Exception type | Condition |
|---|---|
| fromBase is not 2, 8, 10, or 16. -or- value, which represents a non-base 10 unsigned number, is prefixed with a negative sign. | |
| value contains a character that is not a valid digit in the base specified by fromBase. The exception message indicates there are no digits to convert if the first character in value is invalid; otherwise, the message indicates value contains invalid trailing characters. | |
| value, which represents a base 10 unsigned number, is prefixed with a negative sign. -or- The return value is less than UInt16.MinValue or larger than UInt16.MaxValue. |
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.