List<>的数据怎么读取?

lw7210 2007-08-21 09:42:33
List<StationInfo> StationList = new List<StationInfo>();
我相历遍StationList中的某列数据,查找是否有某个具体的值.不知怎么办?
...全文
151 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
兔子-顾问 2007-08-22
  • 打赏
  • 举报
回复
郁闷。看正则的帖子。一不小心撞进来了。
  • 打赏
  • 举报
回复
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

End Class
honey52570 2007-08-21
  • 打赏
  • 举报
回复
wuyazhe(牛肉面)
不是说不来CSDN了的啊

zorou_fatal 2007-08-21
  • 打赏
  • 举报
回复
foreach(StationInfo _stationinfo in StationList )
{

Response.Write(_stationinfo.InfoName);



}
兔子-顾问 2007-08-21
  • 打赏
  • 举报
回复
foreach(StationInfo item in StationList)
{
item......
}

或者用
StationList.GetEnum....

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧