Exclude Holidays Between two days
<p>Hi everybody i'm working a project about calculate specific working days.
My conditions are : Saturday is not holiday, it is working day.</p>

<p>I wrote this code everyting is okey skipped Sundays only , but i want to skip if contains a holiday date.</p>

<p>Problem : skipping Sunday but not skipping passing holiday list values.</p>

<p>Future Date Calculate function :</p>

<pre><code>public DateTime CalculateFutureDate(DateTime fromDate, int numberofWorkDays,
                                     List&lt;DateTime&gt; holidays)
{
    var futureDate = fromDate;
    for (var i = 0; i &lt; numberofWorkDays; i++)
    {
        if (
            futureDate.DayOfWeek == DayOfWeek.Sunday
           || (holidays != null &amp;&amp; holidays.Contains(futureDate)))
        {
            futureDate = futureDate.AddDays(1);
            numberofWorkDays++;
        }
        else
        {
            futureDate = futureDate.AddDays(1);
        }
    }
    while (
           futureDate.DayOfWeek == DayOfWeek.Sunday
            || (holidays != null &amp;&amp; holidays.Contains(futureDate)))
    {
        futureDate = futureDate.AddDays(1);
    }

    return futureDate;
}
</code></pre>

<p>Main function: </p>

<pre><code>List&lt;DateTime&gt; holidayslist = new List&lt;DateTime&gt;();
holidayslist.Add(new DateTime(2016, 09, 7));
holidayslist.Add(new DateTime(2016, 09, 8));
holidayslist.Add(new DateTime(2016, 09, 9));
DateTime izinbaslangic = Convert.ToDateTime(dtpİzinBaslangicTarihi.Value, System.Globalization.CultureInfo.CreateSpecificCulture("tr-TR").DateTimeFormat);
dtpİzinBitisTarihi.Value = CalculateFutureDate(izinbaslangic, Int32.Parse(tbİzinGunu.Text), holidayslist);
</code></pre>

<p>Inputs :  izinbaslangic -> datetimepicker value  and  workingdays -> tbizingunu value</p>

<p>Expecting Outputs :  exclude holiday and weekends show in another datetimepicker new date.</p>

<p>Output :  Only skipping Weekends.Not skipping holidays.</p>

<p>Expecting Output Image :   <a href="http://i.stack.imgur.com/33yR1.jpg" rel="nofollow">enter image description here</a></p>