private void BulkPrint(IScheduleVisitor formatter) { // now format a whole list of schedules, remembering that the description event will // fire as each schedule is visited var schedules = new List <Schedule>() { new DailySchedule() { Frequency = 1 }, new WeeklySchedule() { Frequency = 1, Wednesday = true }, new MonthlySchedule() { Frequency = 3 }, new MonthlyDaySchedule() { Frequency = 3 }, new YearlySchedule() { Frequency = 4 } }; foreach (var s in schedules) { s.Accept(formatter); } }
public void Accept(IScheduleVisitor entity) { // the standard IScheduleVisitor doesn't know about our custom type // unfortunately to wire it up correctly, we need to type check if (entity is IExtendedScheduleVisitor) Accept((IExtendedScheduleVisitor)entity); }
public void Accept(IScheduleVisitor entity) { // the standard IScheduleVisitor doesn't know about our custom type // unfortunately to wire it up correctly, we need to type check if (entity is IExtendedScheduleVisitor) { Accept((IExtendedScheduleVisitor)entity); } }
private void BulkPrint(IScheduleVisitor formatter) { // now format a whole list of schedules, remembering that the description event will // fire as each schedule is visited var schedules = new List<Schedule>() { new DailySchedule() { Frequency = 1 }, new WeeklySchedule() { Frequency = 1, Wednesday = true }, new MonthlySchedule() { Frequency = 3 }, new MonthlyDaySchedule() { Frequency = 3 }, new YearlySchedule() { Frequency = 4 } }; foreach (var s in schedules) s.Accept(formatter); }
public override void Accept(IScheduleVisitor entity) { entity.Visit(this); }
public abstract void Accept(IScheduleVisitor entity);