shadow:standard

Interface CanNegate<T>

interface CanNegate<T>

Interface CanNegate<T> specifies that a class can be negated, producing an object of type T. This interface allows overloading of the unary - operator. If the unary - operator is applied, the appropriate negate() method will be called. Although this interface allows the unary - operator to be overloaded with arbitrary functionality for any class, it is intended to make operations on numerical classes more readable.

Method Summary

Modifiers Return Types Method and Description
public readonly (T) negate()

Method called when the unary - operator is overloaded.

Method Detail

negate

public readonly negate() => (T)

Method called when the unary - operator is overloaded.

Returns

negated version of object