public class tagLunarCal
{
  public int BaseDays;        /* 到西历 1 月 1 日到农历正月初一的累积日数 */
  public int Intercalation;    /* 闰月月份. 0==此年没有闰月 */
  public int BaseWeekday;      /* 此年西历 1 月 1 日为星期几再减 1 */
  public int BaseKanChih;      /* 此年西历 1 月 1 日之干支序号减 1 */
  public int[] MonthDays=new int[13];/* 此农历年每月之大小, 0==小月(29日), 1==大月(30日) */
  tagLunarCal(int basedays,int intercalation,int baseWeekday,int baseKanChih,int[] MonthDays )
  {
     BaseDays=basedays;
     Intercalation=intercalation;
     BaseWeekday=baseWeekday;
     BaseKanChih=baseKanChih; 
     MonthDays=monthDays;
   }
};

解决方案 »

  1.   

    //上面构造函数tagLunarCal(int basedays,int intercalation,int baseWeekday,int baseKanChih,int[] MonthDays )的MonthDays改为monthDays;
    tagLunarCal lunarCal[]=new tagLunarCal[95];
    //初始化1936
    int basedays=23;
    int intercalation=3;
    int baseWeekday=2;
    int baseKanChih=17;
    int[] monthDays={1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0};
    luncarCal[1]=new tagLunarCal(basedays,intercalation,baseWeekday,baseKanChih,monthDays); 
      

  2.   

    struct LunarCal
    {
    int BaseDays;        /* 到西历 1 月 1 日到农历正月初一的累积日数 */
    int Intercalation;    /* 闰月月份. 0==此年没有闰月 */
    int BaseWeekday;      /* 此年西历 1 月 1 日为星期几再减 1 */
    int BaseKanChih;      /* 此年西历 1 月 1 日之干支序号减 1 */
    int [] MonthDays;    /* 此农历年每月之大小, 0==小月(29日), 1==大月(30日) */
    public LunarCal(int bd,int ic,int bw,int bk, int md0,int md1,int md2,int md3,int md4,int md5,int md6,int md7,int md8,int md9,int md10,int md11,int md12)
            {
    BaseDays = bd;
    Intercalation=ic;
    BaseWeekday=bw;
    BaseKanChih=bk;
    MonthDays = new int[13];
    MonthDays[0] = md0;
    MonthDays[1] = md1;
    MonthDays[2] = md2;
    MonthDays[3] = md3;
    MonthDays[4] = md4;
    MonthDays[5] = md5;
    MonthDays[6] = md6;
    MonthDays[7] = md7;
    MonthDays[8] = md8;
    MonthDays[9] = md9;
    MonthDays[10] = md10;
    MonthDays[11] = md11;
    MonthDays[12] = md12;
    }
    static public implicit operator LunarCal(int [] val)
    {
    return new LunarCal(val[0],val[1],val[2],val[3],val[4],val[5],val[6],val[7],val[8],val[9],val[10],val[11],val[12],val[13],val[14],val[15],val[16]);
    }
    }然后这样用
    LunarCal [] lc= new LunarCal[3]
    {
    new int[]{23,  3, 2, 17, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0},  /* 1936 */
    new int[]{41,  0, 4, 23, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1},
    new int[]{30,  7, 5, 28, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1}
    };