Type.GetTypeCode 方法
获取指定 Type 的基础类型代码。
**命名空间:**System
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public Shared Function GetTypeCode ( _
type As Type _
) As TypeCode
用法
Dim type As Type
Dim returnValue As TypeCode
returnValue = Type.GetTypeCode(type)
public static TypeCode GetTypeCode (
Type type
)
public:
static TypeCode GetTypeCode (
Type^ type
)
public static TypeCode GetTypeCode (
Type type
)
public static function GetTypeCode (
type : Type
) : TypeCode
参数
- type
要获取其基础类型代码的 Type。
返回值
基础类型的 TypeCode 值。
示例
' 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)
// 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);
// 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 );
// 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);
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0、1.0