Why this matters
Prevents drift and typos across the codebase.
Define shared string literals (route names, keys, claim types) as constants/enums in a single place.
Prevents drift and typos across the codebase.
Side-by-side examples engineers can pattern-match during review.
if (role == "AdminRoleV2") { /* ... */ }public static class Roles { public const string Admin = "AdminRoleV2"; }
if (role == Roles.Admin) { /* ... */ }if(type=="A"){}if(type==Types.Admin){}From the same buckets as this rule.