-
Notifications
You must be signed in to change notification settings - Fork 641
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
Replace typeof(X).Name
with nameof(X)
#1077
Comments
can i take up this issue? |
Please! Keep us posted on your progress, let us know if you have any questions, and submit a PR when ready. Thanks! |
Using a Regex search might be helpful. I found several hits using this pattern: |
Thanks for the tip! As I understand it, |
That's correct, and be on the lookout for any other similar opportunities to use |
Update: I've completed the moving of
Thanks! |
Great! I do not think there is a better option for Namespace and FullName. No worries there. For (Aside: this is where it would be nice if C# had an equivalent of C++'s If you feel good that you've captured all occurrences, I look forward to reviewing your PR when you're ready. Thanks! |
Is there an existing issue for this?
Task description
Split from PR #1074. There have been a few cases we've fixed where the code has been getting the name of a type as a string by using the pattern
typeof(SomeType).Name
, when code analysis warnings show that we should be usingnameof(SomeType)
instead. This potentially has a small performance benefit if the compiler/PGO is not already smart enough to recognize this pattern, but at the least it will simplify the code and reduce some analysis warnings.The text was updated successfully, but these errors were encountered: