Redigera

Dela via


Information.VbTypeName(String) Method

Definition

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

public:
 static System::String ^ VbTypeName(System::String ^ UrtName);
public static string? VbTypeName (string? UrtName);
public static string VbTypeName (string UrtName);
static member VbTypeName : string -> string
Public Function VbTypeName (UrtName As String) As String

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.

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

See also