AOP C#在行动(续2)

今天开始写Paser了,不过是从SharpDevelop借过来而已(不想重新发明轮子,^_^)。但是,还是对原先的代码作了一些修改,即使到了RC2了,SharpDevelop的代码中还是存在问题。今天看代码是就发现了两处。比如下面的代码:
  static public int Compare(IList a, IList b, IComparer comparer)
  {
      if (a == null || b == null) {
          return 1;
      }
      if (a.Count != b.Count) {
          return Math.Sign(a.Count - b.Count);
      }
      int limit = (a.Count < b.Count) ? a.Count : b.Count;
      for(int i=0; i < limit; i++) {
          if (a[i] is IComparable && b[i] is IComparable) {
           int cmp = comparer.Compare(a[i], b[i]);
           if (cmp != 0) {
               return cmp;
           }
       }
   }
   return a.Count - b.Count;
  }
第二个if块让我迷惑了好一阵。看mono中已经纠正了,怀疑那段语句是不是在喝酒只有写的。

原文:http://dev.csdn.net/article/30/30357.shtm
posted @ 2005-06-06 17:12  潘胜国  阅读(460)  评论(0编辑  收藏  举报