title: Sorting the result of Directory.GetFiles in C#
body: <p>I have this code to list all the files in a directory. </p>
  
  <pre><code>class GetTypesProfiler
  {
      static List&lt;Data&gt; Test()
      {
          List&lt;Data&gt; dataList = new List&lt;Data&gt;();
          string folder = @"DIRECTORY";
          Console.Write("------------------------------------------\n");
          var files = Directory.GetFiles(folder, "*.dll");
          Stopwatch sw;
          foreach (var file in files)
          {   
              string fileName = Path.GetFileName(file);
              var fileinfo = new FileInfo(file);
              long fileSize = fileinfo.Length;
              Console.WriteLine("{0}/{1}", fileName, fileSize);
          }
          return dataList;
      }
      static void Main()
      {
           ...
      }
  }
  </code></pre>
  
  <p>I need to print out the file info based on file size or alphabetical order. How can I sort the result from Directory.GetFiles()? </p>