我的任务是只读取.txt文件中的第二行,并将其保存为字符串,以便稍后在代码中使用。
文件名为“SourceSetting”。在第1和第2行中我有一些单词
对于第1行,我有以下代码:
string Location;
StreamReader reader = new StreamReader("SourceSettings.txt");
{
Location = reader.ReadLine();
}
ofd.InitialDirectory = Location;
这很好,但我该如何使其仅读取第二行,以便我可以将其保存为例如:
string Text
Location = reader.ReadLine(); Text = reader.ReadLine();
- Lucas TrzesniewskiReadLine
吗? - CompuChip