Skip to content

Record classes dont inherit ToString method from base. #109484

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

You must be logged in to vote

See dotnet/sdk#43617 .
Record class always generates a new override for ToString, which uses the default record semantics and doesn't uses base.ToString.

it prints original record ToString instead Element::ToString()

Note that there isn't one implementation of "record ToString". Every record generates its own ToString with that semantic.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@nathan130200
Comment options

@colejohnson66
Comment options

@jilles-sg
Comment options

@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
4 participants