Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim i As Integer
Dim Stations As New System.Collections.Generic.List(Of StationInfo)
Stations.Add(New StationInfo("1", "A站"))
Stations.Add(New StationInfo("2", "B站"))
Stations.Add(New StationInfo("3", "B站"))
For Each station As StationInfo In Stations
If station.StationName = "B站" Then
i += 1
End If
Next
Response.Write(String.Format("找到{0}个B站", i))
End Sub
Private Class StationInfo
Private _StationID As String
Private _StationName As String
Public Property StationID() As String
Get
Return _StationID
End Get
Set(ByVal value As String)
_StationID = value
End Set
End Property
Public Property StationName() As String
Get
Return _StationName
End Get
Set(ByVal value As String)
_StationName = value
End Set
End Property
Sub New(ByVal StationID As String, ByVal StationName As String)
_StationID = StationID
_StationName = StationName
End Sub