Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 703 Bytes

MA0097.md

File metadata and controls

19 lines (17 loc) · 703 Bytes

MA0097 - A class that implements IComparable<T> or IComparable should override comparison operators

class Test : IComparable<T> // non-compliant
{
    public int CompareTo(Test other) => throw null;
}

class Test : IComparable<T> // ok
{
    public int CompareTo(Test other) => throw null;
    public static bool operator <(Test a, Test b) => throw null;
    public static bool operator <=(Test a, Test b) => throw null;
    public static bool operator >(Test a, Test b) => throw null;
    public static bool operator >=(Test a, Test b) => throw null;
    public static bool operator ==(Test a, Test b) => throw null;
    public static bool operator !=(Test a, Test b) => throw null;
}