📜  C# 系统不允许写入 txt 文件 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:42.204000             🧑  作者: Mango

代码示例1
var sourceFile = "text.txt";
var targetFile = @"C:\Users\Tomas\Desktop\MovieStarz\MovieStarz\WriteText.txt";
var id = App.Moviess.Filmerna[index].id.ToString();

var lines = File.ReadAllLines(sourceFile)
    .Where(l => l.Contains(id))
    .ToArray();

File.AppendAllLines(targetFile, lines);