Skip to content

'Fix all in document' for 'Use expression body for operators'Β #41791

@jnm2

Description

@jnm2

Before:

// πŸ›  Use expression body for operators > Fix all in document
//                          ↓
public static bool operator ==(Foo left, Foo right)
{
    return left.Equals(right);
}

public static bool operator !=(Foo left, Foo right)
{
    return !left.Equals(right);
}

public static bool operator <(Foo left, Foo right)
{
    return left.CompareTo(right) < 0;
}

public static bool operator >(Foo left, Foo right)
{
    return left.CompareTo(right) > 0;
}

public static bool operator <=(Foo left, Foo right)
{
    return left.CompareTo(right) <= 0;
}

public static bool operator >=(Foo left, Foo right)
{
    return left.CompareTo(right) >= 0;
}

After:

public static bool operator ==(Foo left, Foo right) => left.Equals(right);

public static bool operator !=(Foo left, Foo right) => !left.Equals(right);

public static bool operator <(Foo left, Foo right) => left.CompareTo(right) < 0;

public static bool operator >(Foo left, Foo right) => left.CompareTo(right) > 0;

public static bool operator <=(Foo left, Foo right) => left.CompareTo(right) <= 0;

public static bool operator >=(Foo left, Foo right) => left.CompareTo(right) >= 0;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions