-
Notifications
You must be signed in to change notification settings - Fork 459
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
Enhance: Inline variable in CA1854 (IDictionary.TryGetValue) #7071
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7071 +/- ##
=======================================
Coverage 96.45% 96.45%
=======================================
Files 1422 1422
Lines 340592 340657 +65
Branches 11230 11243 +13
=======================================
+ Hits 328522 328588 +66
+ Misses 9233 9228 -5
- Partials 2837 2841 +4 |
...t.NetCore.Analyzers/Performance/CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Poker-sang, the changes looks good, could you please update the VB fixer too? Now this only work on C# but not in VB.
@buyaa-n Thank you for the review. I've never written VB, but I tried writing VB fixer anyway, so I'm not sure if I took all the cases into account. Please let me know if there are any problems. |
Thanks, most contributors including myself are same, no previous VB experience, https://converter.telerik.com/ have been helpful for converting code and tests in VB, though looks you don't need it now. Changes looks good |
...ft.NetCore.Analyzers/Performance/BasicPreferDictionaryTryMethodsOverContainsKeyGuardFixer.vb
Outdated
Show resolved
Hide resolved
…rmance/BasicPreferDictionaryTryMethodsOverContainsKeyGuardFixer.vb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Thanks. I use https://sharplab.io/ to see the C#/VB syntax tree. The site you recommended looks good too, I'll try it. |
When simplifying code with
TryGetValue
, we can inline theout
variable.Before:
After: