计算2个日期之间的天数,老师不然我们用DataTime类和TimeSpan类,要我们自己建一个类。下面是方法
public int GetDays()
        {
            int total = 365;
            if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
                total = 366;            switch (m)
            {
                case 1:
                    total -= 31;
                    goto case 2;
                case 2:
                    if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
                        total -= 29;
                    else
                        total -= 28;
                    goto case 3;
                case 3:
                    total -= 31;
                    goto case 4;
                case 4:
                    total -= 30;
                    goto case 5;
                case 5:
                    total -= 31;
                    goto case 6;
                case 6:
                    total -= 30;
                    goto case 7;
                case 7:
                    total -= 31;
                    goto case 8;
                case 8:
                    total -= 31;
                    goto case 9;
                case 9:
                    total -= 30;
                    goto case 10;
                case 10:
                    total -= 31;
                    goto case 11;
                case 11:
                    total -= 30;
                    goto case 12;
                case 12:
                    total -= 31;
                    goto default;
                default:
                    total += d;
                    break;
            }
            return total;
        }        public int Minus(MyDate D1)
        {
            MyDate D2 = new MyDate(2010,10,10);
            int days = Math.Abs(D1.GetDays()-D2.GetDays());
            return days;
        }这个只能算同一年的天数之差,如何才能算不同年的2个日期天数之差。要怎么改啊   谢谢啊