How can get Previous item in list using foreach loop?

Apr 26 2013 4:59 AM
I have a list

var _PublicHoliday = _db.tbl_HolidayMasters.Where(x => x.IsDelete == false).ToList();

and i am geting each item using foreach loop 

foreach (var objPublicHoliday in _PublicHoliday)
                                        if ((Convert.ToDateTime(DateTo.Text).AddDays(1)).Equals(objPublicHoliday.HolidayDate))
                                            todate = Convert.ToDateTime(todate).AddDays(1).Date.ToShortDateString();                                           
                                            flagHoliday = 1;

Whenever I moved next holiday date the how can get previous holiday date in list?


Answers (2)