Thursday, 29 August 2013

How get correct type of T

How get correct type of T

I have some code like this:
Private Shared Function ReStoreFromXML(Of T)(ByVal TargetType As T,
ByVal XMLpath As String) As List(Of T)
If Not TypeSupported(TargetType) Then Return Nothing
....
Return CType(mySerializer.Deserialize(fstream), List(Of T))
TargetType is, for example, MyCustomType.
TypeSupported should check if TargetType is ok. When I try something like
TargetType.GetType
Or
GetType(T)
I get only System.RuntimeType or System.Type. How can I fix this issue?

No comments:

Post a Comment