title: Select First, Last, Min, Max Value based on Time From a List of Objects
body: <p>I have a List of MyObject as below:</p>
  
  <pre><code>public MyObject(reqVal, reqTime)
  {
      _value = reqVal;
      _time = reqTime;
  
  }
  
  public double Value
  {
       get {return _value;}
  }
  
  public DateTime Time
  {
       get {return _time;}
  }
  
  var myList = new List&lt;MyObject&gt;();
  myList.Add(new MyObject(100, new DateTime(2012, 03, 01, 10, 0, 0));
  myList.Add(new MyObject(50, new DateTime(2012, 03, 01, 10, 3, 0));
  myList.Add(new MyObject(10, new DateTime(2012, 03, 01, 10, 6, 0));
  myList.Add(new MyObject(230, new DateTime(2012, 03, 01, 10, 9, 0));
  ....
  </code></pre>
  
  <p>As you  can see this list holds the values for a whole day and each value is generated every 3 min. How can I find the following based on the chunk of 15 min:</p>
  
  <ol>
  <li>maxVal</li>
  <li>minVal</li>
  <li>openVal</li>
  <li>closeVal</li>
  </ol>
  
  <p>so if the 1st datetime value is 2012/03/01 10:00
  I need to find the 4 above between 10:00 and 10:15 then next set of 4 between 10:15 and 10:30 and so on ...</p>
  
  <p>so all these values will be calculated based on their time range
  for example 2nd maxVal or openVal will be the maxVal and openVal between 10:15 and 10:30</p>
  
  <p>any help would be much appreciated,</p>
  
  <p>Thanks.</p>