Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 889639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:36:00+00:00 2026-05-15T13:36:00+00:00

Which naming convention do you use for local constants in C# and why? const

  • 0

Which naming convention do you use for local constants in C# and why?

const int Pi = 3;
const int pi = 3;

It seems the trade-off is between lower camel-case indicating restricted scope, and upper camel-case being more readable and easier to move to a class level. I’ve noticed StyleCop prefers upper camel-case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:36:01+00:00Added an answer on May 15, 2026 at 1:36 pm

    I’m used to upper case (pascal case) for everything except variables and fields. Global constants are an exception to the fields, I don’t know why, probably because they are public in some cases. Local constants are also lowercase so.

    It’s just a matter of taste imo. Of course, within a product / team, there should be an agreement.

    On the other hand, our coding guideline requires full uppercase for constants, this would be PI in this case. I don’t like this because upper cases are hard to read and need underlines for separation (which is against code analysis rules). Nobody follows this guideline anymore.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a naming convention to use underscore prefix for views which are not
I have been following the following naming convention for my database. lower case letters
Given an OO language in which the naming convention for object properties is camelCased,
I have a client who wishes to use a URL naming convention along the
I am trying to figure out a naming convention to use when naming my
I have read that it is bad practice to use naming convention id on
Currently .NET uses their own nonstandard capturing group naming convention which is a dog.
Possible Duplicate: What package naming convention do you use for personal/hobby projects in Java?
Does anyone use a prettier naming convention for these types of methods? I know
My question is, which version-naming scheme should be used for what type of project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.