Here is the code how we could get previous working day with respect to Today's day.
Note: Here I'm considering Saturday and Sunday as regular holidays and not considering any other holiday (e.g. Diwali, Christmas, Eid etc.).
DateTime GetPreviousWorkingDay()
{
DateTime dtPrevDay;
dtPrevDay = DateTime.Today.AddDays(-1);
switch (dtPrevDay.DayOfWeek)
{
case System.DayOfWeek.Saturday:
dtPrevDay = dtPrevDay.AddDays(-1);
break;
case System.DayOfWeek.Sunday:
dtPrevDay = dtPrevDay.AddDays(-2);
break;
}
return dtPrevDay;
}