在我的 C# 应用程序中,我试图向 ReadLine() 提供一个简单的文本文档,其中包含 7 个数字字符串逐行分隔。我试图做的是每次调用函数时获取下一个 7 位字符串。这是我到目前为止所拥有的:
string invoiceNumberFunc()
{
string path = @"C:\Users\sam\Documents\GCProg\testReadFile.txt";
try
{
using (StreamReader sr = new StreamReader(path))
{
invoiceNumber = sr.ReadLine();
}
}
catch (Exception exp)
{
Console.WriteLine("The process failed: {0}", exp.ToString());
}
return invoiceNumber;
}
每次调用 invoiceNumberFunc() 时如何前进到下一行?
提前致谢。