C
Chris
I have the following code where I want to return a type Hotel()
Function GetHotel as Hotel()
'... Init Code here
Dim arrH As New ArrayList
Do While Reader.Read
Dim H As New Hotel(Reader.GetString(1), Reader.GetInt32(0))
arrH.Add(H)
Loop
Reader.Close()
Dim Hs(arrH.Count - 1) As Hotel
For ii As Integer = 0 To arrH.Count - 1
Hs(ii) = DirectCast(arrH(ii), Hotel)
Next
Return Hs
End Function
Is this the best way to do this? I guess I could use reDim Preserve but
thought that was an ugly way to do it too? What's best way to do this?
Chris
Function GetHotel as Hotel()
'... Init Code here
Dim arrH As New ArrayList
Do While Reader.Read
Dim H As New Hotel(Reader.GetString(1), Reader.GetInt32(0))
arrH.Add(H)
Loop
Reader.Close()
Dim Hs(arrH.Count - 1) As Hotel
For ii As Integer = 0 To arrH.Count - 1
Hs(ii) = DirectCast(arrH(ii), Hotel)
Next
Return Hs
End Function
Is this the best way to do this? I guess I could use reDim Preserve but
thought that was an ugly way to do it too? What's best way to do this?
Chris