Name

SystemTypeName Function

Class

Microsoft. VisualBasic.Information

Syntax

SystemTypeName(vbname)
vbname

Use: Required

Type: String

The name of a VB .NET data type

Return Value

A String indicating the name of a CTS data type

Description

Returns the name of the Common Type System (CTS) data type that corresponds to a particular Visual Basic data type

Rules at a Glance

  • 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.

Example

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 ...

Get VB .NET Language in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.