コード例 #1
0
        public override bool Equals(Object obj)
        {
            if (obj == null || !(obj is WeekDay))
            {
                return(false);
            }

            WeekDay w = (WeekDay)obj;

            return(w.Value == Value);
        }
コード例 #2
0
        public WeekDay[] GetWeekStartingWith(WeekDay day)
        {
            if (day == Sunday)
            {
                return new WeekDay[] { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }
            }
            ;
            if (day == Monday)
            {
                return new WeekDay[] { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }
            }
            ;
            if (day == Tuesday)
            {
                return new WeekDay[] { Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, Monday }
            }
            ;
            if (day == Wednesday)
            {
                return new WeekDay[] { Wednesday, Thursday, Friday, Saturday, Sunday, Monday, Tuesday }
            }
            ;
            if (day == Thursday)
            {
                return new WeekDay[] { Thursday, Friday, Saturday, Sunday, Monday, Tuesday, Wednesday }
            }
            ;
            if (day == Friday)
            {
                return new WeekDay[] { Friday, Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday }
            }
            ;
            if (day == Saturday)
            {
                return new WeekDay[] { Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday }
            }
            ;

            return(null);
        }