microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.34k stars 2.21k forks source link

about tuple and record suggest #1331

Closed nczsl closed 1 year ago

nczsl commented 2 years ago

tuple is already a general function in c# and the current implementation is "ValueTuple" because the new functional "record" is very similar to it, which makes it difficult for users to choose,so I suggest Can the underlying implementation of tuples be directly replaced by "record", or can "ValueTuple" be implemented together with record In this way, users can not pay attention to whether record or struct record or "Tuple" or "ValueTuple" should be used

svick commented 2 years ago

I'm not sure I quite understand what you're asking, but I don't think it would be possible, because tuples and records don't behave the same and modifying that would be a breaking change.

For example, tuples with matching types are the same and can be assigned to each other. But records are named types, and records with different types are not the same, even if the types of their properties matched.