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

Replace typeof(X).Name with nameof(X) #1077

Open
1 task done
paulirwin opened this issue Dec 25, 2024 · 3 comments
Open
1 task done

Replace typeof(X).Name with nameof(X) #1077

paulirwin opened this issue Dec 25, 2024 · 3 comments
Assignees
Labels
good-first-issue Good for newcomers is:task A chore to be done pri:low up-for-grabs This issue is open to be worked on by anyone

Comments

@paulirwin
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

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 using nameof(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.

@paulirwin paulirwin added up-for-grabs This issue is open to be worked on by anyone good-first-issue Good for newcomers pri:low is:task A chore to be done labels Dec 25, 2024
@paulirwin paulirwin added this to the 4.8.0-beta00018 milestone Dec 25, 2024
@manognya-b
Copy link

can i take up this issue?

@paulirwin
Copy link
Contributor Author

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!

@paulirwin
Copy link
Contributor Author

Using a Regex search might be helpful. I found several hits using this pattern: typeof\([^\)]*\)\.Name. There may be other, similar variations of this pattern, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Good for newcomers is:task A chore to be done pri:low up-for-grabs This issue is open to be worked on by anyone
Projects
None yet
Development

No branches or pull requests

2 participants