Imports System
Imports System.Reflection
Imports System.Collections.Generic
Imports Microsoft.VisualBasic
Public Class B(Of T, U)
End Class
Public Class A(Of V)
Public Function GetSomething(Of X)() As B(Of V, X)
Return New B(Of V, X)()
End Function
End Class
Public Class Base(Of T, U)
End Class
Public Class Derived(Of V)
Inherits Base(Of Integer, V)
End Class
Public Class Test
Public Shared Sub Main()
Dim derivedType As Type = GetType(Derived(Of ))
DisplayGenericTypeInfo(derivedType)
End Sub 'Main
Private Shared Sub DisplayGenericTypeInfo(ByVal t As Type)
Console.WriteLine(t.IsGenericTypeDefinition)
Console.WriteLine(t.IsGenericType)
Console.WriteLine(t.ContainsGenericParameters)
If t.IsGenericType Then
Dim typeArguments As Type() = t.GetGenericArguments()
Console.WriteLine(typeArguments.Length )
For Each tParam As Type In typeArguments
If tParam.IsGenericParameter Then
Console.WriteLine(tParam.ToString())
Console.WriteLine(tParam.GenericParameterPosition)
Else
Console.WriteLine(tParam.ToString())
End If
Next tParam
End If
End Sub
End Class