【1】获取固定日期范围内的所有日期,以数组形式返回
/// <summary> /// 获取固定日期范围内的所有日期,以数组形式返回 /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> private DateTime[] GetAllDays(DateTime startTime ,DateTime endTime) { List<DateTime> listDay = new List<DateTime>(); DateTime dtDay = new DateTime(); //循环比较,取出日期; for (dtDay = startTime; dtDay.CompareTo(endTime) <= 0;dtDay = dtDay.AddDays(1)) { listDay.Add(dtDay); } return listDay.ToArray(); }