This documentation is archived and is not being maintained.

Int16Converter Class

Provides a type converter to convert 16-bit signed integer objects to and from other representations.

For a list of all members of this type, see Int16Converter Members.


[Visual Basic]
Public Class Int16Converter
   Inherits BaseNumberConverter
public class Int16Converter : BaseNumberConverter
public __gc class Int16Converter : public BaseNumberConverter
public class Int16Converter extends BaseNumberConverter

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


This converter can only convert a 16-bit signed integer object to and from a string. The Int16 value type represents signed integers with values ranging from negative 32768 through positive 32767.

The ConvertFrom method uses the Parse method of Int16 with the integer value of NumberStyles.

The ConvertTo method uses the general ("G") format for the string returned.

For more information about type converters, see the TypeConverter base class and Implementing a Type Converter.

Note   You should never create an instance of an Int16Converter. Instead, call the GetConverter method of TypeDescriptor. For more information, see the examples in the TypeConverter base class.


[Visual Basic, C#, C++] The following sample converts a variable of type Int16 to a string, and vice versa.

[Visual Basic] 
Dim myInt16 As Short = -10000
Dim myInt16String As String = "+20000"
Console.WriteLine(TypeDescriptor.GetConverter(myInt16).ConvertTo(myInt16, GetType(String)))

short myInt16 = -10000;
string myInt16String = "+20000";
Console.WriteLine(TypeDescriptor.GetConverter(myInt16).ConvertTo(myInt16, typeof(string))); 

short myInt16( -10000 );
String* myInt16String = S"+20000";
Console::WriteLine(TypeDescriptor::GetConverter(__box(myInt16))->ConvertTo(__box(myInt16), __typeof(String)));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.ComponentModel

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

Int16Converter Members | System.ComponentModel Namespace