get merged data from List of object based on properties in C# : <p>I am using a List , where AccountInformation has three properties </p>

<pre><code>public class AccountInformation 
{
        public string AccountNumber{ get; set; }
        public int StartDate { get; set; }
        public int EndDate{ get; set; }
}
</code></pre>

<p>Now I am getting my List of data something like this</p>

<pre><code>AccountNumber  StartDate   EndDate
 AC1           20150101    20150110
 AC1           20150110    20150111
 AC1           20150111    20150112
 AC2           20150112    20150115
 AC1           20150116    20150120
 AC1           20150121    20150125
 AC2           20150125    20150130
 AC2           20150130    20150205
</code></pre>

<p>Now I need to get this data as final output in below fashion</p>

<pre><code> AccountNumber  StartDate   EndDate
 AC1           20150101    20150111
 AC2           20150112    20150115
 AC1           20150116    20150120
 AC1           20150121    20150125
 AC2           20150125    20150005
</code></pre>

<p>Means wherever I am getting consecutive AccountNumber as same and EndDate of first row is same as StartDate of next row, I need to merge those rows.</p>

<p>Any help is appreciated.</p>
