Hi -- Like kstevens715 I also prefer VB.NET and can get by with C# but the issue in Chapter 26 that kstevens715 mentions has also tripped me up. Any idea on how to solve it? FYI, the code I'm using is here:
Private Function GetStoredList(Of T As Class)() As List(Of T)
Dim typeName As String = GetType(T).Name
Dim _list As List(Of T) = Nothing
Select Case typeName
Case "Activity" : _list = TryCast(_activities, List(Of Activity))
Case "Destination" : _list = TryCast(_destinations, List(Of Destination))
Case "Lodging" : _list = TryCast(_lodgings, List(Of Lodging))
Case Else
Throw New NotSupportedException("You cannot make an UntrackedList from this type.")
End Select
Return _list
End Function
And the compiler errors are as follows:
- Value of type 'System.Collections.Generic.List(Of BAGA.Activity)' cannot be converted to 'System.Collections.Generic.List(Of T)'.
- Value of type 'System.Collections.Generic.List(Of BAGA.Destination)' cannot be converted to 'System.Collections.Generic.List(Of T)'.
- Value of type 'System.Collections.Generic.List(Of BAGA.Lodging)' cannot be converted to 'System.Collections.Generic.List(Of T)'.
Help is greatly appreciated!