namespace WinFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string filePath = @"D:\data.txt";
FileInfo fileInfo = new FileInfo(filePath);
DateTime lastAccessTime = fileInfo.LastAccessTime;
MessageBox.Show($"The last access time of the file is: {lastAccessTime}");
}
}
}
/*
run:
The last access time of the file is: 26/01/2024 17:44:59
*/