Dim obj As Object = New SubListA(Of SubClassA) Dim baseType = obj.GetType While baseType.FullName <> "System.Object" Dim name As String = baseType.FullName If name.StartsWith("System.Collections.Generic.List`") Then MsgBox("7,objは、List(Of) と一致") End If baseType = baseType.BaseType End While
Dim obj As Object = New SubListA(Of SubClassA) Dim baseType = obj.GetType While baseType.FullName <> "System.Object" Dim name As String = baseType.FullName If name.StartsWith("System.Collections.Generic.List`") Then Dim argType = baseType.GetGenericArguments(0) While argType.FullName <> "System.Object" Dim argTypeName = argType.FullName If argTypeName = "WindowsApp1.Form1+ClassA" Then MsgBox("8,objは、ジェネリック(Of ClassA) と一致") End If argType = argType.BaseType End While Exit While End If baseType = baseType.BaseType End While