SystemTypeName Function |
Microsoft. VisualBasic.Information
SystemTypeName( vbname )
The name of a VB.NET data type
A String indicating the name of a CTS data type
Returns the fully qualified type name of the Common Type System (CTS) data type that corresponds to a particular Visual Basic data type
vbname must be the name of a valid VB.NET data type, such as Boolean, Byte, Char, Date. Decimal, Double, Integer, Long, Object, Short, Single, or String.
If vbname is not a valid VB.NET data type, the function returns Nothing .
If vbname does not directly correspond to a CTS data type, the function returns Nothing . For example, user -defined types created with the Structure construct and classes created with the Class construct both return Nothing if their data type names are passed to the function.
Public Structure Point Dim x As Integer Dim y As Integer End Structure Public Class CEmployee End Class Module modMain Public Sub Main ' Returns System.Int32 Dim i As Integer = 100 Console.WriteLine("Type of i: " & SystemTypeName(TypeName(i))) ' Returns Nothing Dim o As Object Console.WriteLine("Type of o: " & SystemTypeName(TypeName(o))) ' Returns Nothing Dim oEmp As New CEmployee Console.WriteLIne("Type of oEmp: " & SystemTypeName(TypeName(oEmp))) ' Returns Nothing Dim uPt As Point Console.Writeline("Type of uPt: " & SystemTypeName(TypeName(uPt))) ' Returns System.String Dim sName As String = "This is a string." Console.WriteLine("Type of sName: " & SystemTypeName(TypeName(sName))) End Sub End Module
To determine the CTS data type of a particular variable, pass the variable as an argument to the TypeName function, and pass its return value as an argument to the SystemTypeName function. For example:
strType = SystemTypeName(TypeName(myVar))
The existence of the SystemTypeName function clearly indicates that VB.NET data types are wrappers for CTS data types.
The SystemTypeName function is new to VB.NET.
TypeName Function, VbTypeName Function