Does anyone know of any compiler magic I could apply to universally replace the implementations of .Equals(...)
and .GetHashCode()
in record
types? I want to modify these such that when they contain an ImmutableArray<>
they use sequence equality (.SequenceEqual(...)
) instead of reference equality.
Currently, .Equals(...)
and .GetHashCode()
need to be manually provided on every record
type that contains an ImmutableArray<>
in order for the designed value equality to work. This process is labour-intensive, prone to error, adds a maintenance overhead, and makes the signal (other aspects of the record) hard to see among the noise (boiler-plate implementation). This is in spite of ImmutableArray<>
being (as the name suggests) immutable.