我正在尝试“移动”一个文件并使用File.Move
. 在我需要在特定文件夹中添加存储文件之前,它就起作用了。由于添加了完整路径,我可以创建文件,我可以写入它们,但是一旦我尝试使用File.Move
它,就会给我“NotSupportedException”一个我拥有的一些代码的示例:
private static void myMethod(String file)
{
File.Delete(file);
using (sout = new StreamWriter(pathStart + "temp.txt"))
{
foreach(Deck deck in deckList)
{
if (deck != null)
{
sout.WriteLine(myString);
sout.WriteLine(otherString);
sout.Flush();
}
}
}
File.Move(pathStart + "temp.txt", pathStart + file);
File.Delete(pathStart + "temp.txt");
}
任何帮助将不胜感激。