Can I configure to use UPPER_CASE for constants and enums?

Visual Studio 22

Since my early days programming in C, I’ve always had the habit of declaring constants in UPPER_CASE, and I’d like to keep that naming convention in the .NET ecosystem. For that, I want to configure Visual Studio to automatically fix naming violations.

https://preview.redd.it/al4wk5ouu9yf1.png?width=742&format=png&auto=webp&s=8acf1c5c129a2d5ffebed18a48a6d8c0eb232b84

As shown in the image, I managed to set this up for private and static fields, but I couldn’t find a way to apply the same rule to enums and constants. I’ve tried several times without success.

When I declare a constant, I don’t want it to be CreditCard, I’d prefer CREDIT_CARD. The same goes for enums: instead of DebitCard, I’d like to use DEBIT_CARD.

Does anyone know how to configure this in Visual Studio?

Posted Oct 30, 2025, 4:01 PM UTC

04
Loading comments…