似乎我需要将一些值分配给变量var(),我不知道如何。有人可以帮我解决这个问题。
Imports System
Imports System.IO
Module Module1
Sub Main()
Dim i As Integer
Dim var() As String
Dim lines() As String = IO.File.ReadAllLines("C:\Users\carment\Desktop\Test.txt")
i = 1
For Each line As String In lines
var(i) = line
Console.WriteLine(var(i))
i = i + 1
Next
End Sub
End Module
答案 0 :(得分:2)
您还必须初始化数组:
var = New String(lines.Length-1) {}