在 C# 中获取文件修改日期

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10497769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 14:04:22  来源:igfitidea点击:

Get file modify date in C#

c#file

提问by sanchop22

How do I read the modify date of the file in C#?

如何在 C# 中读取文件的修改日期?

I can read the creation date of the file by using the code below:

我可以使用以下代码读取文件的创建日期:

ModifyDate = File.GetCreationTime(FilePath)

采纳答案by Filippo Pensalfini

File.GetLastWriteTimewill do the job

File.GetLastWriteTime将完成这项工作

回答by Kris

I believe you're looking for GetLastWriteTime

我相信您正在寻找GetLastWriteTime