Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想编写一个程序来连续监视文件并给我更新的东西,比如添加一行,删除一行,使用 c# 在一行中修改。我做了文件监控,如何知道更新的东西。请帮帮我
就像@Soner Gönül 说的那样,你没有花太多精力来写你的问题,我相信这很快就会结束。有一些与其他问题的链接,您可以从中获得一些灵感。
我相信您每次检查更改时都需要进行一些比较,请阅读以下其他问题的答案:
(有一些使用 linq 的示例可能对您有所帮助)
逐行比较两个文本文件
比较c#中的2个文本文件内容
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ad07af87-4664-4475-a820-d77c756a93f7
此外,来自 Microsof Support 的这个示例还告诉您如何创建文件比较函数:
http://support.microsoft.com/kb/320348