Show info on image types : FileInfo « File Directory Stream « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;


  class Program
  {
    static void Main(string[] args)
    {
      DirectoryInfo dir = new DirectoryInfo(@"C:\Windows\Web\Wallpaper");
      FileInfo[] imageFiles = dir.GetFiles("*.jpg");
      Console.WriteLine("Found {0} *.jpg files\n", imageFiles.Length);
      foreach (FileInfo f in imageFiles)
      {
        Console.WriteLine("File name: {0}", f.Name);
        Console.WriteLine("File size: {0}", f.Length);
        Console.WriteLine("Creation: {0}", f.CreationTime);
        Console.WriteLine("Attributes: {0}", f.Attributes);
      }
    }
  }








15.13.FileInfo
15.13.1.Open an existing file and return a FileStream
15.13.2.Create StreamWriter from FileInfo
15.13.3.Create FileStream from FileInfo for writing
15.13.4.Create FileStream from FileInfo for reading
15.13.5.File Sorter
15.13.6.Show info on image types