title: How can I use LINQ and C# to find the oldest date from 3 different files?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5200877/how-to-select-min-and-max-date-values-in-linq-query">How to Select Min and Max date values in Linq Query</a>  </p>
  </blockquote>
  
  
  
  <p>I'll start by saying my experience with LINQ is very limited. I have been using nested if statements to find the oldest file of 3, and it works just fine. But I'm trying to expand my use of newer technology. A lot of what I read about LINQ gets way over my head pretty fast. Especially when they start using lambda's. So I can get the 3 files dates but how can I grab the oldest among them using LINQ? Or is it even possible? I have the psudo code below. </p>
  
  <pre><code>        DateTime file1 = File.GetLastWriteTime(@"c:\test1.txt");
          DateTime file2 = File.GetLastWriteTime(@"c:\test2.txt");
          DateTime file3 = File.GetLastWriteTime(@"c:\test3.txt");
  
          DateTime[] dates = { file1, file2, file3 };
  
          var date = from d in dates
                     where d is oldest date
                     select d;
  </code></pre>
  
  <p>Thanks</p>