0
所以我发现这个代码在网上(通常我做C#但是我想教SmallBASIC和我的一个朋友),基本上读取文件:为什么我必须包含索引?
TextWindow.Write("Enter the name of the new directory: ")
DirectoryName = TextWindow.Read()
files = File.GetFiles(DirectoryName)
TextWindow.WriteLine("This is the content in the file: ")
TextWindow.WriteLine(File.ReadContents(files[1]))
我明白了什么,所有的做,但为什么它需要是files[1]
而不是仅仅是files
?
删除索引[1]
只是使行不工作,程序仍然编译和whatnot。
SB没有调试器,在线资源不太好。
当行不行,有没有具体的错误消息?我想它需要索引器,因为'files'是某种类型的集合,而'File.ReadContents()'需要该类型的单个实例。 – David