Casting Generic Types

Posted by David Rutten on Stack Overflow See other posts from Stack Overflow or by David Rutten
Published on 2010-04-20T23:22:52Z Indexed on 2010/04/20 23:23 UTC
Read the original article Hit count: 302

Filed under:
|
|
Public Function CastToT(Of T)(ByVal GenericType(Of Object) data) As GenericType(Of T)
   Return DirectCast(data, GenericType(Of T))
End Function

The above clearly does not work. Is there any way to perform this cast if I know that all objects inside data are in fact of Type T?

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about casting