Get .NET Type Kind
Returns the kind of a .NET type (e.g. Class, Module, Interface, Enum, Struct, Delegate).
VB
Public Function GetTypeKind(assembly As Assembly,
typeFullName As String) As String
Try
Dim t As Type = assembly.GetType(typeFullName, throwOnError:=False, ignoreCase:=True)
If t Is Nothing Then Return "Unknown"
' Check for VB.NET Module
If t.IsDefined(GetType(Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute), inherit:=False) Then
Return "Module"
End If
If t.IsClass Then Return "Class"
If t.IsInterface Then Return "Interface"
If t.IsEnum Then Return "Enum"
If t.IsValueType Then Return "Struct"
If GetType([Delegate]).IsAssignableFrom(t.BaseType) Then Return "Delegate"
Return "Unknown"
Catch
Return "Unknown"
End Try
End Function