我已经搜索了大约一个小时,但无法找到解决问题的方法。我试图在某个目录中显示所有 .txt 文件,除了以“_days.txt”结尾的文件。这是我的代码,希望对你有所帮助。谢谢!
foreach (FileInfo file in files)
{
if (file.Name.Substring(file.Length - 9, file.Length) != "_days.txt") //I get errors on this row, saying "Arg1, Arg2; Cannot convert from "long" to "int"
{
listBox1.Items.Add(file.Name);
}
}