Cis*_*ran 4 c# filestream argumentexception
所以我正在尝试编译一个Asteroids游戏.它几乎正常工作,所有文件都到位等等......
当它遇到这个代码时会出现问题.
FileStream myFileStream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
string myTempFile = @"F:\Documents\Junior School\Computer Programming (Java 1)\AsteroidsWithSound\AsteroidsWithSound\temp\mysound" + i.ToString() + ".wav";
Run Code Online (Sandbox Code Playgroud)
它给了我一个错误/警告,不知道究竟它叫什么,但它说
ArgumentException未处理.空路径名称不合法.
我在网上看过像这样的代码块引起了这个问题但却找不到解决方案.任何帮助都是极好的.
编辑:文件名在此块中定义.
string filename = this.Player.FileName;
this.Player.Open("");
File.Delete(filename);
this.isReady = true;
Run Code Online (Sandbox Code Playgroud)