generics casting question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PJ6

    #1

    generics casting question

    Is there any way I can get the compiler to accept this kind of generic type
    upcasting at runtime?

    Paul

    Public Class GenericClass(Of SomeType As {New})
    End Class

    Public Sub Test()

    Dim foo As New GenericClass(Of Integer)
    Dim bar As GenericClass(Of Object) = DirectCast(Dire ctCast(foo,
    Object), GenericClass(Of Object))

    End Sub


Working...