基本上我需要有人帮助我或向我展示允许我从名为 c1.txt 的文件中读取名称和价格的代码。
这是我已经拥有的。
TextReader c1 = new StreamReader("c1.txt");
if (cse == "c1")
{
string compc1;
compc1 = c1.ReadLine();
Console.WriteLine(compc1);
Console.WriteLine();
compcase = compc1;
compcasecost = 89.99;
}
如何从文本文档中选择要读取的行也很棒。