title: Files in directory sort by fileName ascending
body: <p>I am having a list of files from a directory and I want to sort it out by filename.</p>
  
  <p>This is the main code:</p>
  
  <pre><code>var localPath = this.Server.MapPath("~/Content/Img/" + type + "/");
  var directory = new DirectoryInfo(localPath);
  isDirectory = directory.Exists;
  
  if (isDirectory)
  {
      foreach (FileInfo f in directory.GetFiles())
      {
          Picture picture = new Picture();
  
          picture.ImagePath = path;
          picture.CreationDate = f.CreationTime;
          picture.FileName = f.Name;
          listPictures.Add(picture);
      }
  }
  </code></pre>
  
  <p>here is the class Picture where all the files are stored:</p>
  
  <pre><code>public class Picture
  {
      public string ImagePath { get; set; }
      public string FileName { get; set; }
      public DateTime CreationDate { get; set; }
  }
  </code></pre>
  
  <p>How do you do to sort a files list by order of FileName?</p>