我收到一个错误,如标题中所示。我不知道为什么我会得到这个,也不知道我应该如何解决这个问题。Visual Studio给出了该行标题中显示的错误: var f= System.IO.File.OpenRead(fil1);
class Program {
static void Main(string[] args) {
Stopwatch sw = Stopwatch.StartNew();
string fil1 = "C:\Users\mariu\Desktop\Jobboppgave\CaseConsoleApp\Prisfile.txt";
***var f = System.IO.File.OpenRead(fil1);***
int length = (int)(new System.IO.FileInfo(fil1).Length);
发布于 2018-10-07 17:07:54
您的路径不正确,因为您没有在其中转义\
。最快的方法是使用@
string fil1 = @"C:\Users\mariu\Desktop\Jobboppgave\CaseConsoleApp\Prisfile.txt";
重新构建您的项目,问题将得到解决。
https://stackoverflow.com/questions/52686917
复制相似问题