This documentation is archived and is not being maintained.
Type.GetTypeCode Method
.NET Framework 1.1
Gets the underlying type code of the specified Type.
[Visual Basic] Public Shared Function GetTypeCode( _ ByVal type As Type _ ) As TypeCode [C#] public static TypeCode GetTypeCode( Type type ); [C++] public: static TypeCode GetTypeCode( Type* type ); [JScript] public static function GetTypeCode( type : Type ) : TypeCode;
Parameters
- type
- The Type whose underlying type code to get.
Return Value
The TypeCode value of the underlying type.
Example
[Visual Basic] ' Creates an object of 'Type' class. Dim myType1 As Type = Type.GetType("System.Int32") ' Get the 'TypeCode' of the 'Type' class object created above. Dim myTypeCode As TypeCode = Type.GetTypeCode(myType1) Console.WriteLine("TypeCode is: {0}", myTypeCode) [C#] // Create an object of 'Type' class. Type myType1 = Type.GetType("System.Int32"); // Get the 'TypeCode' of the 'Type' class object created above. TypeCode myTypeCode = Type.GetTypeCode(myType1); Console.WriteLine("TypeCode is: {0}",myTypeCode); [C++] // Create an object of 'Type' class. Type* myType1 = Type::GetType(S"System.Int32"); // Get the 'TypeCode' of the 'Type' class object created above. TypeCode myTypeCode = Type::GetTypeCode(myType1); Console::WriteLine(S"TypeCode is: {0}",__box( myTypeCode));
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
Show: