Within a Web Service CarService,
- I have a class called Car.
- Car has a bunch of properties i.e. Car.Color.
- CarService has a method called GetCars().
- Within GetCar, I have a loop that appends a List of, you guessed it.. Cars.
Dim carList As New List(Of Car)
Do While rdr.Read()
If rdr.GetValue(1).ToString().Length > 0 Then
Dim c As Car = New Car
c.Color = rdr.GetValue(1).ToString()
carList.Add(c)
End If
Loop
GetCars() returns carList.
I also have another page within a different project that consumes that data.
Or at least, I'd like to and here's my problem..
If I do..
Dim myNewCars As List(Of Namespace.Car)
myNewCars = CarServiceProxy.GetCars()
I get:
Value of type '1-dimensional array of Namespace.Car' cannot be converted to 'System.Collections.Generic.List(Of Namespace.Car)'.
What would be the best way to convert this 1-dimensional array' back into a List of Cars?