Overrid Equals Defined Operator

Posted Javi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Overrid Equals Defined Operator相关的知识,希望对你有一定的参考价值。

 public class Common
    {

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }
        public int WeightMax { get; set; } = 0;
        public int WeightLarge { get; set; } = 0;
        public int WeightSmall { get; set; } = 0;
        public int WeightMin { get; set; } = 0;
        public static bool operator ==(Common m1, Common m2)
        {
            if (m1.WeightLarge == m2.WeightMax) return true;
            return false;
        }
        public static bool operator !=(Common m1, Common m2)
        {
            if (m1.WeightMax != m2.WeightLarge) return true;
            return false;
        }
    }

 

以上是关于Overrid Equals Defined Operator的主要内容,如果未能解决你的问题,请参考以下文章

求教args用法,equals用法,具体如下:

jsp在访问的时候,调试信息输出ReferenceError:xxx is not defined

在 C# 中将字符串转换为比较操作

#if defined的介绍

关于#if defined和#ifdef

关于#if(defined(__WIN32__)的问题