Information.VbTypeName(String) Method

Definition

Returns a String value containing the Visual Basic data type name of a variable.

C#
public static string? VbTypeName(string? UrtName);
C#
public static string VbTypeName(string UrtName);

Parameters

UrtName
String

Required. String variable containing a type name used by the common language runtime.

Returns

Returns a String value containing the Visual Basic data type name of a variable.

Examples

The following example uses the VbTypeName function to return data type names for several variables.

VB
Dim sysDateName As String = "System.DateTime"
Dim sysShortName As String = "Int16"
Dim sysBadName As String = "Nonsense"
Dim testVbName As String
testVbName = VbTypeName(sysDateName)
' Returns "Date".
testVbName = VbTypeName(sysShortName)
' Returns "Short".
testVbName = VbTypeName(sysBadName)
' Returns Nothing.

Remarks

VbTypeName returns the Visual Basic type name corresponding to the common language runtime type name. For example, if UrtName contains "Int32" or "System.Int32", VbTypeName returns "Integer". If VbTypeName does not recognize the value of UrtName, it returns Nothing (not the string "Nothing").

The type name in UrtName can be obtained from various sources, for example from the Name property in the MemberInfo array of the Type class.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also