title: order by in lambda expressions
body: <p>I'm trying to sort the data in lambda expression in the following case.</p>
  
  <pre><code>if (Directory.Exists(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["ErrorLogPath"].ToString())))
  {
      string path = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["ErrorLogPath"].ToString());
      // a.Select(p =&gt; Path.GetFileNameWithoutExtension(p));
      var a = Directory.GetFiles(path);
      if (a != null)
      {
          Session["gvData"] = a.ToList();
          BindDataToGrid();
      }
  }
  </code></pre>
  
  <p>In <code>var</code> <code>a</code> i get list of complete path of files like </p>
  
  <pre><code>c:\\logfiles\\01022012.txt. 
  </code></pre>
  
  <p>How can I get <code>var</code> <code>a</code> sorted on basis of <code>01022012</code>
  I tried  </p>
  
  <pre><code>var a = Directory.GetFiles(path).OrderBy(p=&gt;Path.GetFileNameWithoutExtension(p));
  </code></pre>
  
  <p>but not working. Is there any thing am I doing wrong?</p>
  
  <p>Getting result as </p>
  
  <pre><code>"C:\\LogFiles\\01112012.txt" 
  "C:\\LogFiles\\08102012.txt" 
  "C:\\LogFiles\\14092012.txt" 
  "C:\\LogFiles\\15102012.txt" 
  "C:\\LogFiles\\17102012.txt" 
  "C:\\LogFiles\\19092012.txt" 
  </code></pre>
  
  <p>Expected is </p>
  
  <pre><code>"C:\\LogFiles\\14092012.txt" 
  "C:\\LogFiles\\19092012.txt" 
  "C:\\LogFiles\\08102012.txt" 
  "C:\\LogFiles\\15102012.txt" 
  "C:\\LogFiles\\17102012.txt" 
  "C:\\LogFiles\\01112012.txt" 
  </code></pre>