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的主要内容,如果未能解决你的问题,请参考以下文章