Has anyone got a good bit of code to turn a string into a given type in a type-safe manner
i.e.
VB Code:
Public Shared Function FromString(Of TReturn)(ByVal stringValue As String) As TReturn If (String.IsNullOrWhiteSpace(stringValue)) Then If GetType(TReturn).IsPrimitive Then 'get the default Else Return Nothing End If Else If GetType(TReturn).IsPrimitive Then Else End If End If End Function
Anyone got some good ideas on filling in those blanks?




Reply With Quote