title: How to take first file name from a folder in C#
body: <p>I need to get the first file name from a folder. How can I get this in C#?</p>
  
  <p>The code below returns all the file names:</p>
  
  <pre><code>DirectoryInfo di = new DirectoryInfo(imgfolderPath);
  foreach (FileInfo fi in di.GetFiles())
  {
      if (fi.Name != "." &amp;&amp; fi.Name != ".." &amp;&amp; fi.Name != "Thumbs.db")
      {
          string fileName = fi.Name;
          string fullFileName = fileName.Substring(0, fileName.Length - 4);
  
           MessageBox.Show(fullFileName);
      }
  }
  </code></pre>
  
  <p>I need the first file name.</p>