Skip to content

There is some way to implement "with" operator without declaring records? #7848

Closed Answered by theunrepentantgeek
nathan130200 asked this question in Q&A
Discussion options

You must be logged in to vote

Why types with `record ' modifier, it implements an equality comparer of its own internally, I can't override that method and I need a specific comparator.

You can override the way a record implements equality - by explicitly declaring bool Equals(R? other). The compiler fills in everything else for you.

See this Stack Overflow answer for more details and links to more information.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nathan130200
Comment options

Answer selected by nathan130200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants