the following generic method gives the compile error "Error 13 Value of type 'Distribution' cannot be converted to 't'" :
Public Shared Function CreateObject(Of t)(ByVal ID As Integer) As t
Dim TType As Type = GetType(t)
If TType Is GetType(Distribution) Then
Return CreateDistribution(ID)
ElseIf TType Is GetType(Accrual) Then
Return CreateAccrual(ID)
End If
End Function
CreateDistribution returns an object of type 'Distribution'. I'm trying to get the method to perform an action based on the type of t supplied and then return an object of type t. What am I doing wrong?
** Edit: I've commented out the entirety of Distribution other than the class declaration and still get the same error.