我有下一个代码。我正在读取一个文本文件,创建一个记录列表(我的结构)。接下来,我需要从表单上的文本框中的团队名称等于团队名称的列表中获取所有 Records 对象
Public Class Form1
Structure Record
Sub New(ByVal arr As String())
Me.team = arr(0)
Me.player = arr(1)
Me.bats = CInt(arr(2))
Me.hits = CInt(arr(3))
End Sub
Dim team As String
Dim player As String
Dim bats As Integer
Dim hits As Integer
End Structure
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim team As String = txtTeam.Text
Dim records As New List(Of Record)
records.AddRange(
From line In IO.File.ReadAllLines("Baseball.txt")
Select New Record(line.Split(","c))
)
records = records.FindAll(Function(record) record.team.Equals(team))
Dim a As Integer = 1
a += 1
End Sub
End Class
问题是我收到 0 条记录后
records = records.FindAll(Function(record) record.team.Equals(team))
有什么建议么?
PS:这是为了断点
Dim a As Integer = 1
a += 1