Create the FileInfo class from the file selected in the OpenFileDialog : File « File Directory Stream « C# / CSharp Tutorial






using System;
using System.Windows.Forms;
using System.IO;

class MainClass
{
  public static void Main() 
  {
    OpenFileDialog dlgOpen = new OpenFileDialog();
    if (dlgOpen.ShowDialog() == DialogResult.OK)
    {
      FileInfo fi = new FileInfo(dlgOpen.FileName);
      Console.WriteLine("Filename " + fi.FullName );
      Console.WriteLine(" Created at " + fi.CreationTime );
      Console.WriteLine(" Accessed at " + fi.LastAccessTime );
    }
  }
}








15.1.File
15.1.1.Key Members of the System.IO Namespace
15.1.2.File: GetCreationTime and GetLastAccessTime
15.1.3.Create the FileInfo class from the file selected in the OpenFileDialog
15.1.4.File.Exists
15.1.5.File.ReadAllLines
15.1.6.File.WriteAllLines