今天开始写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

相关文章:

  • 2021-04-19
  • 2021-11-22
  • 2021-06-25
  • 2021-10-12
  • 2022-02-22
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-22
  • 2021-07-28
  • 2022-12-23
  • 2021-09-19
  • 2021-04-05
  • 2021-07-30
  • 2021-08-19
相关资源
相似解决方案