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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:42:25+00:00 2026-06-15T11:42:25+00:00

I’ve consulted a few msdn articles that address c# coding conventions and naming guidelines

  • 0

I’ve consulted a few msdn articles that address c# coding conventions and naming guidelines (C# Coding Conventions and Naming Guidelines) as well as a similar question on stack overflow from a few months back.

I’m not certain how to handle two variables which are in scope at the same time, that hold the [conceptually] same data in different types.

An example which would help illustrate the issue would be an identifier that is initially held as a string, but is then cast/parsed to an integer.

I’ve come up with 3 possible courses of action, and I’m sure that I missed plausible options.

COA #1:

int iRecordId;
string sRecordId;

Where one or both of the variables prefix a type abbreviation. This violates the MS coding guidelines stating not to prefix parameter names with Hungarian type notation.

COA #2:

int recordId;
string recordIdString;

Where one or both of the variables explicitly state the type in the name. This just seems klunky and while it doesn’t use Hungarian notation, it seems to violate the spirit of the previous COA.

COA #3:

int recordIdForDatabase;
string recordIdFromUrl;

Where each variable is further qualified by where the data came from, or is going.

Proposal

My thought is that I ultimately want to distinguish between two variables that only differ by type, so while there are guidelines that explicitly state not to prefix variables with type information, I’m leaning towards using a Hungarian prefix. Since it is in stark contrast with the naming conventions in the remainder of the code, it seems that it will highlight the extenuating circumstance. Is this a reasonable approach?

Questions, comments, and cries of outrage are all welcomed.

  • 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-06-15T11:42:27+00:00Added an answer on June 15, 2026 at 11:42 am

    First option is obsolete because we’re not using Hunharian Notation any more.

    Second option is not bad and I saw it usage in different projects.

    But last option is preferable from my point of view because it shows semantic difference between two variable rather than difference in types.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this

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.