title: What is a good way to find the latest created file in a folder in c#?
body: <p>I have a network folder which can contain up to 10,000 files (usually around 5000).</p>
  
  <p>What is the fatest way I can get the filepath of the most recently created file in that folder using c#?</p>
  
  <p>Currently I am using the below, but wondered if there was a quicker way.</p>
  
  <p>Thanks.</p>
  
  <pre><code>DirectoryInfo di = new DirectoryInfo(xmlFileLocation);
  var feedFiles = di.GetFiles("*.xml");
  var sortedFeedFile = from s in feedFiles
                       orderby s.CreationTime descending
                       select s;
  
  if(sortedFeedFile.Count() &gt; 0){
      mostRecentFile = sortedFeedFile.First();
  }
  </code></pre>