示例#1
0
        public int CompareTo(object obj)
        {
            IWeekDay bd = null;

            if (obj is string)
            {
                bd = new WeekDay(obj.ToString());
            }
            else if (obj is IWeekDay)
            {
                bd = (IWeekDay)obj;
            }

            if (bd == null)
            {
                throw new ArgumentException();
            }
            else
            {
                int compare = this.DayOfWeek.CompareTo(bd.DayOfWeek);
                if (compare == 0)
                {
                    compare = this.Offset.CompareTo(bd.Offset);
                }
                return(compare);
            }
        }
示例#2
0
 public override bool Equals(object obj)
 {
     if (obj is WeekDay)
     {
         WeekDay ds = (WeekDay)obj;
         return(ds.Offset == Offset &&
                ds.DayOfWeek == DayOfWeek);
     }
     return(base.Equals(obj));
 }