using System;
using System.IO;
class Test
{
public static void Main()
{
string path = @"c:\Temp\MyTest.txt";
if (!File.Exists(path))
{
File.Create(path);
}
else
{
File.SetLastWriteTime(path, new DateTime(2010,4,3));
}
DateTime dt = File.GetLastWriteTime(path);
Console.WriteLine("The last write time for this file was {0}.", dt);
File.SetLastWriteTime(path, DateTime.Now);
dt = File.GetLastWriteTime(path);
Console.WriteLine("The last write time for this file was {0}.", dt);
}
}