![](https://images0.cnblogs.com/blog/98633/201409/260035478102878.png)
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace weekDemo { class Program { static void Main(string[] args) { DayOfWeek[] dw = new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek .Sunday}; var query = GetWeekDays(DateTime.Now, DateTime.Now.AddMonths(1), dw); foreach (var item in query.ToList()) { Console.WriteLine(item.ToShortDateString() + "--星期:" + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(item.DayOfWeek)); } } public static IEnumerable<DateTime> GetWeekDays(DateTime begin, DateTime end,DayOfWeek[] dws) { return Enumerable.Range(0, (end - begin).Days).Where(c => dws.Contains(begin.AddDays(c).DayOfWeek)).Select(c => begin.AddDays(c)); } } }