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 7694311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:17:26+00:00 2026-05-31T21:17:26+00:00

I have always prefixed my Constants with CN_ as shown below but I am

  • 0

I have always prefixed my Constants with CN_ as shown below but I am now working on coding to accepted standards, which I found linked on this site. The standards say that I should drop the CN_ for my constants. So with the example below, if I change my CN_NetPrice to NetPrice, I will a conflict with the method property of the same name. Obviously I can’t do that so I am left with a question. Do I have a naming convention problem or is there a problem with my code in general?

public class TicketInformation
{
    private const string CN_StartDate = "StartDate";
    private const string CN_EndDate = "EndDate";
    private const string CN_NetPrice = "NetPrice";
    private const string CN_NetTotalPrice = "NetTotalPrice";
    private const string CN_Tickets = "Tickets";

    public decimal NetPrice { get; set; }
    public decimal NetTotalPrice { get; set; }
    public decimal Tickets { get; set; }

    public static TicketInformation Create(DateTime startDate, DateTime endDate)
    {
        try
        {
            TicketInformation ti = new TicketInformation();
            using (DataTable dt = DAC.ExecuteDataTable(
                "GetAllTicketInformationSelect", 
                DAC.Parameter(CN_StartDate, startDate), 
                DAC.Parameter(CN_EndDate, endDate)))
            {
                ti.NetTotalPrice = Convert.ToDecimal(dt.Rows[0][CN_NetTotalPrice]);
                ti.NetPrice = Convert.ToDecimal(dt.Rows[0][CN_NetPrice]);
                ti.Tickets = Convert.ToDecimal(dt.Rows[0][CN_Tickets]);
            }
            return ti;
        }
        catch (Exception ex)

        {
            throw new Exception(Convert.ToString(ex));
        }
    }

}

}

  • 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-31T21:17:28+00:00Added an answer on May 31, 2026 at 9:17 pm

    Your constant doesn’t actually represent the net price (etc) does it? It represents the name of the net price column. So I would suggest either:

    private const string StartDateColumn = "StartDate";
    private const string EndDateColumn = "EndDate";
    private const string NetPriceColumn = "NetPrice";
    private const string NetTotalPriceColumn = "NetTotalPrice";
    private const string TicketsColumn = "Tickets";
    

    Or:

    private static class Columns
    {
        internal const string StartDate = "StartDate";
        internal const string EndDate = "EndDate";
        internal const string NetPrice = "NetPrice";
        internal const string NetTotalPrice = "NetTotalPrice";
        internal const string Tickets = "Tickets";
    }
    

    Or use an enum:

    private enum Column
    {
        StartDate, EndDate, NetPrice, NetTotalPrice, Tickets;
    }
    

    … calling ToString on one of those enum values will give the name.

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

Sidebar

Related Questions

I have always used the mouseover event, but while reading the jQuery documentation I
I have always found startup profile files of other people both useful and instructive
I have always seen the keywords async used in Silverlight but was wondering if
I have always worked with mySQL, but have recently recieved a spec for a
I have a data variable sent to client-side, but it may not always be
Arrays have always been my downfall in every language I've worked with, but I'm
I have always used winforms to do my projects but I have never really
I have always found it a matter of Debate; If the Programmer should work
I have always and will continue to always close an HTML input such as
I have always thought that in order to connect to SQL server using windows

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.