简体   繁体   English

c#如何检查.txt是否没有改变

[英]c# how to check if .txt has NOT changed

i have a C# Application that changes a .txt File all the time while running.我有一个 C# 应用程序,它在运行时始终更改 .txt 文件。 do you guys have any idea to control the .txt file and show a message when it has not changed since ( for example 1 Minute).你们有什么想法来控制 .txt 文件并在它没有改变时显示一条消息(例如 1 分钟)。 So i can check if my application stops running.所以我可以检查我的应用程序是否停止运行。

thanks for any help or suggestion.感谢您的任何帮助或建议。

Try this:尝试这个:

var lastWriteTime = File.GetLastWriteTime("someFilePath");

This returns the date and time the specified file or directory was last written to.这将返回上次写入指定文件或目录的日期和时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM