我正在尝试在VB中编写Let
,它不会让我这样做,它会不断删除它。我需要下载包还是什么?
例如:
If Not currentDirectory = "" Then
Dim lines() As String = System.IO.File.ReadAllLines(currentDirectory)
Dim data = From line In lines
Let nam = line.Split(","c)(0)
Let num = line.Split(","c)(1)
Order By nam Ascending
Select nam, num
DataGridView1.DataSource = data.ToList
DataGridView1.CurrentCell = Nothing
DataGridView1.Columns("nam").HeaderText = "Name"
DataGridView1.Columns("num").HeaderText = "Phone Number"
End If
它不会让我输入“让我们”
答案 0 :(得分:2)
你谋杀了Linq查询理解。您需要在查询部分之间使用空行键入不带,如果添加额外的空行,文本编辑器不会键入Let
。请记住,行结尾是VB.NET中的语句终止符
正确输入,它应该如下所示:
Dim data = From line In lines
Let nam = line.Split(","c)(0)
Let num = line.Split(","c)(1)
Order By nam Ascending
Select nam, num