you are viewing a single comment's thread
view the rest of the comments
[–] 4 points 2 years ago (2 children)

I've only had to implement equality in C# but that didn't seem that hard of a problem. you just expand the operator = function

  • source
  • hideshow 4 child comments
  • [–] 11 points 2 years ago (2 children)

    It's not hard, just if you're doing it for a struct with a lot of fields it's a lot of boilerplate

  • source
  • parent
  • hideshow 4 child comments
  • [–] -5 points 2 years ago* (2 children)

    My IDE can do that for me. And it was able to do that pre AI boom. Yes, the code ends up more verbose, but I just collapse it.

    So from a modern dev UX perspective, this shouldn't be a major difference.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 7 points 2 years ago (1 child)

    Then you should also override Equals(object), GetHashCode, and implement IEquatable<T>.

    Thankfully a lot of the usual boilerplate code can be avoided using a record class or struct:

    public record Person(string Name, uint Age);
    
  • source
  • parent
  • hideshow 2 child comments