我正在尝试从 C# 中当前用户的 appdata 文件夹中的文件读取,但我仍在学习,所以我有这个:
int counter = 0;
string line;
// Read the file and display it line by line.
System.IO.StreamReader file = new System.IO.StreamReader("c:\\test.txt");
while ((line = file.ReadLine()) != null)
{
Console.WriteLine(line);
counter++;
}
file.Close();
// Suspend the screen.
Console.ReadLine();
但我不知道输入什么来确保它始终是当前用户的文件夹。