public static bool Compare(Week w1, Week w2) { if ((w1.month.id == w2.month.id) && (w1.start == w2.start) && (w1.end == w2.end)) { return(true); } else { return(false); } }
//возвращает данные по ключу public string GetData(Month month, Week week, int course) { ScheduleKey sk = new ScheduleKey(month, week, course); if (data.ContainsKey(sk)) { return(data[sk]); } else { return(null); } }
//записывает данные по ключу public bool SetData(Month month, Week week, int course, string value) { ScheduleKey sk = new ScheduleKey(month, week, course); if (data.ContainsKey(sk)) { data[sk] = value; return(true); } else { data.Add(sk, value); return(false); } }
public override bool Equals(object obj) { ScheduleKey sk = obj as ScheduleKey; return(this.course == sk.course && this.month.id == sk.month.id && Week.Compare(this.week, sk.week)); }
public ScheduleKey(Month m, Week w, int c) { month = m; week = w; course = c; }