小编bdu*_*anw的帖子

无法将文本写入文件

所以,基本上,我试图在我的文本 rpg 中创建一个保存点。我想通过使用 .txt 文件并以这种方式跳转到每个方法来做到这一点。但是,当我尝试输入文件的路径和字符串内容时,它返回 CS0029 错误并指出它无法将 void 转换为字符串。

public void PickingUpScroll()
    {

        savePoint = "PickingUpScroll";
        saveData = File.WriteAllText(savePath, savePoint);
         
        hasFireMagic = true;

        Console.WriteLine("You approach the strange scroll in your room and pick it up. A strange light eminates from the foreign symbols on the paper. You feel a warmth in your hands.\nLooking down, you notice they are glowing with a strange light, almost like fire.");
        Console.ForegroundColor = ConsoleColor.Cyan;
        Console.WriteLine("You have accquired 'Fire Magic'");
        Console.ForegroundColor = ConsoleColor.White;


        if (hasWeapons == …
Run Code Online (Sandbox Code Playgroud)

c# console-application

-2
推荐指数
1
解决办法
81
查看次数

标签 统计

c# ×1

console-application ×1