I have the following class:
Public Class TrainStation
Public FileName As String
Public StationName As String
Public TrainID As eTrainID 'an enum
End Class
I have a list of this class:
Dim nList As new List(Of TrainStation)
'....
I would now like to go through each "StationName" preferrably like this:
For Each sStationName As String In nList.StationName
If StrLen(sStationName) > 0 Then
'...
End If
Next
Is that possible? Preferrably without LINQ because I just don't get warm with it.
Thank you!
CodePudding user response:
Can you loop through the list of stations and then check the property against the station. So the object will be a TrainStation instead of a string. Like so:
For Each station In nList
If station.StationName.Length > 0 Then
'...
End If
Next