You can use the File.GetLastWriteTime
method to retrieve the last modified date of a file in C#:
main.cs274 chars13 lines
In this example, we first specify the file path for which we want to retrieve the last modified date. We use this path as an argument to the File.GetLastWriteTime
method, which returns a DateTime
object representing the file's last modified date. Finally, we display this date using Console.WriteLine
.
gistlibby LogSnag