System.IO.IOException:共享路径冲突

问题描述 投票:0回答:1

我收到以下共享冲突:

System.IO.IOException: 'Sharing violation on path /data/user/0/android_game.android_game/files/GameSave.txt'

[使用Visual Studio尝试以下代码以在Environment.SpecialFolder.Personal目录中写入/读取文件时

string FilePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
FilePath = Path.Combine(FilePath, "GameSave.txt");

StreamWriter savefile = new StreamWriter(FilePath, true);
savefile.WriteLine("test");

StreamReader sr = new StreamReader(FilePath);
Console.WriteLine(sr.ReadLine());
sr.Close();

对于上下文,我只需要一个游戏的基本文本保存文件,就不会与其他应用共享。谢谢您的任何帮助。

c# android visual-studio xna monogame
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.