title: Traverse list and create records based on date
body: <p>I have a list of Data, each of which has 3 datetime property. I need to split the list based on the <code>fromDate</code> and <code>toDate</code> for a given <code>endDate</code>. Is there a way that I can split my main list into sublists so that I have all data in the list as of <code>endDate</code> value? </p>
  
  <p>Basic idea is to get revenue at the end of a period can be quarterly, monthly or annually. and based on the revenue for how many months, I have to allocate the revenue for each month.</p>
  
  <blockquote>
    <p>revenue for month = revenue for period * days in month/days in period</p>
  </blockquote>
  
  <p>I have currently extracted a set of Data with the input dataset using linq to sql.</p>
  
  <pre><code>var result = (from c in context.BillingRevenues where c.HoldingDate &gt;= firstDayOfTheYear &amp;&amp; c.HoldingDate &lt;= endDate &amp;&amp; c.RecordType.Equals("I")
                                      join s in seedAccountNumbers
                                      on c.AccountNumber equals s
                               select c).ToList();
                      return result;
  </code></pre>
  
  <p>I want to use this result set and then get the expected output.</p>
  
  <p>my DataSet</p>
  
  <pre><code>endDate  fromDate  toDate  Amount HoldingDate
  3/31/18  1/1/18    2/28/18 1000
  3/31/18  1/1/18    3/31/18 1000
  3/31/18  1/1/18    1/31/18 1000
  </code></pre>
  
  <p>result DataSet</p>
  
  <pre><code>endDate  fromDate  toDate  HoldingDate Amount
  3/31/18  1/1/18    2/28/18 1/31/18     1000/59(days)*31(days)
  3/31/18  1/1/18    2/28/18 2/28/18     1000/59(days)*28(days)
  3/31/18  1/1/18    3/31/18 1/31/18     1000/90(days)*31(days)
  3/31/18  1/1/18    3/31/18 2/28/18     1000/90(days)*28(days)
  3/31/18  1/1/18    3/31/18 3/31/18     1000/90(days)*31(days)
  3/31/18  1/1/18    1/31/18 1/31/18     1000/31(days)*31(days) 
  </code></pre>