我有日期時間範圍:如何從日期範圍獲取日期時間列表?
var _checkInYear = (from d in db.bookings select d.checkinyear).ToList();
var _checkInMonth = (from d in db.bookings select d.checkinmonth).ToList();
var _checkInDay = (from d in db.bookings select d.checkinday).ToList();
var _checkOutYear = (from d in db.bookings select d.checkoutyear).ToList();
var _checkOutMonth = (from d in db.bookings select d.checkoutmonth).ToList();
var _checkOutDay = (from d in db.bookings select d.checkoutday).ToList();
我怎樣才能從這個範圍DateTime
名單?例如,如果入住時間爲20/08/2011,並且23/08/2011需要在此範圍內列入日期時間。
20/08/2011,21/08/2011,22/08/2011,23/08/2011。
嗯,這可能是問題的目的,一個人爲的例子,但我擔心這甚至不會做你想要什麼。你可能會更好使用'var checkInData = bookings.Select(new DateTime(d.CheckinYear,d.CheckinMonth,d.CheckinDay))。ToList();'等。除此之外,很難給你提供的東西回答你的問題。你能否進一步擴大? –