C# 封装的功能强大的中国农历日历操作类的代码

将代码过程经常用的代码片段备份一下,下边资料是关于C# 封装的功能强大的中国农历日历操作类的代码,希望能对大伙有些用途。

    private static int leapDays(int y)
    {
        if (leapMonth(y) != 0)
        {
            if ((lunarInfo[y - 1900] & 0x10000) != 0)
                return 30;
            else
                return 29;
        }
        else
            return 0;
    }

    private static int leapMonth(int y)
    {
        return (int)(lunarInfo[y - 1900] & 0xf);
    }

    private static int monthDays(int y, int m)
    {
        if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0)
            return 29;
        else
            return 30;
    }

    private static String AnimalsYear(int y)
    {
        return Animals[(y - 4) % 12];
    }

    private static String cyclicalm(int num)
    {
        return (Gan[num % 10] + Zhi[num % 12]);
    }

    private static String cyclical(int y)
    {
        int num = y - 1900 + 36;
        return (cyclicalm(num));
    }

                <h4>附件:<a href="/uploadfiles/2013/09/08/137864371111554.zip">源代码下载</a></h4>

猜你喜欢

转载自blog.51cto.com/14135053/2331072
今日推荐