Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ide0033.md #44492

Merged
merged 3 commits into from
Jan 23, 2025
Merged

Update ide0033.md #44492

merged 3 commits into from
Jan 23, 2025

Conversation

K4PS3
Copy link
Contributor

@K4PS3 K4PS3 commented Jan 23, 2025

Remove tuple names to access implicit Item1 name

Summary

Tuple names removed to allow access to implicit names.


Internal previews

📄 File 🔗 Preview link
docs/fundamentals/code-analysis/style-rules/ide0033.md Use explicitly provided tuple name (IDE0033)

Remove tuple names to access implicit Item1 name
@K4PS3 K4PS3 requested review from gewarren and a team as code owners January 23, 2025 03:43
@dotnetrepoman dotnetrepoman bot added this to the January 2025 milestone Jan 23, 2025
@dotnet-policy-service dotnet-policy-service bot added dotnet-fundamentals/svc community-contribution Indicates PR is created by someone from the .NET community. labels Jan 23, 2025
@gewarren
Copy link
Contributor

@K4PS3 I don't think this change is necessary. You can use Item1/Item2 even if the items are named. The following code compiles just fine:

        (string name, int age) customer = GetCustomer();
        var name = customer.Item1;
        name = customer.name;

@K4PS3
Copy link
Contributor Author

K4PS3 commented Jan 23, 2025

The suggested changes will make the example clear and show the difference between the two cases.
Even the code editor IntelliSense in visual studio hides the auto names when explicit names provided.
Also the example show the case when the IDE0033 is disabled, the user will expect example with violated values but with disabled rule.

@gewarren
Copy link
Contributor

@K4PS3 Okay, can you also update the Visual Basic snippet too then?

K4PS3 added 2 commits January 23, 2025 19:45
Update VB example with implicit tuple names
@K4PS3
Copy link
Contributor Author

K4PS3 commented Jan 23, 2025

@gewarren The Visual Basic snippet updated to reflect the same changes.

Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @K4PS3

@gewarren gewarren merged commit 9de3b0f into dotnet:main Jan 23, 2025
8 checks passed
@K4PS3
Copy link
Contributor Author

K4PS3 commented Jan 24, 2025

@gewarren You're welcome, Thanks for merging it.

@K4PS3 K4PS3 deleted the patch-1 branch January 24, 2025 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates PR is created by someone from the .NET community. dotnet-fundamentals/svc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants