Mega Code Archive

 
Categories / C# / File Stream
 

Get file Creation Time

/* Mastering Visual C# .NET by Jason Price, Mike Gunderloy Publisher: Sybex; ISBN: 0782129110 */  /*   Example15_3.cs illustrates the File class */ using System; using System.Windows.Forms; using System.IO; public class Example15_3  {     [STAThread]   public static void Main()    {     // create and show an open file dialog     OpenFileDialog dlgOpen = new OpenFileDialog();     if (dlgOpen.ShowDialog() == DialogResult.OK)     {       // use the File class to return info about the file       string s = dlgOpen.FileName;       Console.WriteLine("Filename " + s);       Console.WriteLine(" Created at " + File.GetCreationTime(s));       Console.WriteLine(" Accessed at " +         File.GetLastAccessTime(s));     }   } }