UInt16Converter Class
Definition
Provides a type converter to convert 16-bit unsigned integer objects to and from other representations.
public class UInt16Converter : System.ComponentModel.BaseNumberConverter
- Inheritance
Inherited Members
System.ComponentModel.BaseNumberConverter
System.ComponentModel.TypeConverter
System.Object
Examples
The following example converts a variable of type UInt16 to a string and vice versa.
unsigned short myUInt16(10000);
String^ myUInt16String = "20000";
Console::WriteLine( TypeDescriptor::GetConverter( myUInt16 )->ConvertTo( myUInt16, String::typeid ) );
Console::WriteLine( TypeDescriptor::GetConverter( myUInt16 )->ConvertFrom( myUInt16String ) );
ushort myUInt16 = 10000;
string myUInt16String = "20000";
Console.WriteLine(TypeDescriptor.GetConverter(myUInt16).ConvertTo(myUInt16, typeof(string)));
Console.WriteLine(TypeDescriptor.GetConverter(myUInt16).ConvertFrom(myUInt16String));
'This data type is not supported in Visual Basic.
Remarks
This converter can only convert a 16-bit unsigned integer object to and from a string.
The UInt16 value type represents unsigned integers with values ranging from 0 to 65535. This data type is not supported in Visual Basic.
Note
You should never create an instance of a UInt16Converter. Instead, call the GetConverter method of TypeDescriptor. For more information, see the examples in the TypeConverter base class and How to: Implement a Type Converter.
Constructors
| UInt16Converter() |
Initializes a new instance of the UInt16Converter class. |