zoukankan      html  css  js  c++  java
  • 重载 Sort, ==, !=

       class Items:IComparable
        {
            public string Item { get; set; }
            public string File { get; set; }
            public string IsScored { get; set; }
            public string Weight { get; set; }
    
            public int CompareTo(object obj)
            {
                if (obj is Items)
                {
                    Items second = obj as Items;
                    if (this.Item.CompareTo(second.Item) == 1)
                        return 1;
                    else
                        return -1;
                }
                else
                    return -1;
            }
    
            
            public static bool operator !=(Items first, Items second)
            {
                bool pass = true;
                if ((first.Item != second.Item) || (first.File != second.File) || (first.IsScored != second.IsScored) || (first.Weight != second.Weight))
                    pass = true;
                else
                    pass = false;
                return pass;
            }
    
            public static bool operator ==(Items first, Items second)
            {
                bool pass = true;
                if ((first.Item == second.Item) && (first.File == second.File) && (first.IsScored == second.IsScored) && (first.Weight == second.Weight))
                    pass = true;
                else
                    pass = false;
                return pass;
    
            }
        }
  • 相关阅读:
    jquery 插件扩展2
    jquery 插件扩展
    call apply bind
    bom object
    js oop 封装
    js oop 继承
    js页面之间传参2
    js弹出新窗口的6中方法
    display Tag
    js中extends方法
  • 原文地址:https://www.cnblogs.com/qixue/p/2966330.html
Copyright © 2011-2022 走看看