我有一系列具有开始日期和结束日期的术语。我怎样才能找到今天是否在条款之间。代码是
var termsforcurrentCalendar = UnitOfWork.SchoolTerms.Query().Where(x
=> x.SchoolCalendarId == currentCalendar.SchoolCalendarId).ToArray();
var noOfTerms = termsforcurrentCalendar.Count();
for (int i = 0; i < noOfTerms; i++)
{
if (DateTime.Today > termsforcurrentCalendar[i].EndDate)
{
if (i != noOfTerms)
{
if (DateTime.Today < termsforcurrentCalendar[i + 1].StartDate)
{
datetoBeChecked = termsforcurrentCalendar[i + 1].StartDate;
}
}
}
}