By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,728 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

generics casting question

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


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(DirectCast(foo,
Object), GenericClass(Of Object))

End Sub
Jul 10 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.