.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
					
public class Program
{
	public static void Main()
	{
		List<DateTime> allowedDates = new List<DateTime>();
		List<DateTime> excludedDates = new List<DateTime>();
		Console.WriteLine("Excluded Dates");
		excludedDates.AddRange(DatesInRange(new DateTime(2018, 6, 4), new DateTime(2018, 6, 6)));
		excludedDates.AddRange(DatesInRange(new DateTime(2018, 6, 11), new DateTime(2018, 6, 14)));
		excludedDates.AddRange(DatesInRange(new DateTime(2018, 6, 17), new DateTime(2018, 6, 20)));
		DateTime startDate = new DateTime(2018, 6, 1);
		DateTime checkDate = startDate;
		while(checkDate.Month == startDate.Month) 
		{
			if(!excludedDates.Any(ed => ed == checkDate))
			{
				allowedDates.Add(checkDate);
			}
			checkDate = checkDate.AddDays(1);
		}
		Console.WriteLine("Allowed Dates");
		allowedDates.ForEach(ad => Console.WriteLine(ad));
	}
	static List<DateTime> DatesInRange (DateTime startDate, DateTime endDate)
	{
		
		List<DateTime> datesInRange = new List<DateTime>();
		DateTime checkDate = startDate;
		while(endDate.Day >= checkDate.Day) 
		{
			datesInRange.Add(checkDate);
			Console.WriteLine(checkDate.ToString());
			checkDate = checkDate.AddDays(1);
		}
		return datesInRange;
	}
}
;