-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
🚧 work in progressarea-StylingIndicates if an issue or a PR is for style changesIndicates if an issue or a PR is for style changes
Description
Link to the issue description: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1507
Rule Description
Rule CA1507 flags the use of a string literal as an argument to a method or constructor where a nameof (NameOf in Visual Basic) expression would add maintainability. The rule fires if all of the following conditions are met:
- The argument is a string literal or constant.
- The argument corresponds to a string-typed parameter of the method or the constructor that's being invoked (that is, there is no conversion involved at the call site).
- Either:
- The declared name of the parameter is paramName and the constant value of the string literal matches the name of a parameter of the method, lambda, or local function within which the method or constructor is being invoked.
- The declared name of the parameter is propertyName and the constant value of the string literal matches the name of a property of the type within which the method or constructor is being invoked.
Metadata
Metadata
Assignees
Labels
🚧 work in progressarea-StylingIndicates if an issue or a PR is for style changesIndicates if an issue or a PR is for style changes