zoukankan      html  css  js  c++  java
  • IComparer 指定排序。

        public class NeEntityComparer : IComparer<NeEntity>
        {
            public int Compare(NeEntity x, NeEntity y)
            {
                if (x == null)
                {
                    if (y == null)
                    {
                        // If x is null and y is null, they're
    
                        // equal. 
    
                        return 0;
                    }
                    else
                    {
                        // If x is null and y is not null, y
    
                        // is greater. 
    
                        return -1;
                    }
                }
                else
                {
                    // If x is not null...
    
                    //
    
                    if (y == null)
                    // ...and y is null, x is greater.
                    {
                        return 1;
                    }
                    else
                    {
                        // ...and y is not null, compare the 
    
                        // lengths of the two strings.
    
                        //
    
    
    
                        int retval = x.NeID.CompareTo(y.NeID);
    
                        return retval;
                    }
                }
    
    
            }
        }

  • 相关阅读:
    Python字符串
    ListCtrl控件
    leetcode1004
    leetcode1003
    leetcode1002
    leetcode153
    leetcode540
    leetcode435
    leetcode999
    leetcode997
  • 原文地址:https://www.cnblogs.com/m7777/p/4039334.html
Copyright © 2011-2022 走看看