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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:42:00+00:00 2026-05-11T06:42:00+00:00

I often find myself implementing a class maintaining some kind of own status property

  • 0

I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict?

public class Car {   public enum Status   {     Off,     Starting,     Moving   };    Status status = Status.Off;    public Status Status // <===== Won't compile =====   {     get { return status; }     set { status = value; DoSomething(); }   } } 

If the Status enum were common to different types, I’d put it outside the class and the problem would be solved. But Status applies to Car only hence it doesn’t make sense to declare the enum outside the class.

What naming convention do you use in this case?

NB: This question was partially debated in comments of an answer of this question. Since it wasn’t the main question, it didn’t get much visibility.

EDIT: Filip Ekberg suggests an IMO excellent workaround for the specific case of ‘Status’. Yet I’d be interesting to read about solutions where the name of the enum/property is different, as in Michael Prewecki’s answer.

EDIT2 (May 2010): My favorite solution is to pluralize the enum type name, as suggested by Chris S. According to MS guidelines, this should be used for flag enums only. But I’ve come to like it more and more. I now use it for regular enums as well.

  • 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. 2026-05-11T06:42:00+00:00Added an answer on May 11, 2026 at 6:42 am

    I’ll add my 1 euro to the discussion but it’s probably not adding anything new.

    The obvious solution is to move Status out of being a nested Enum. Most .NET enums (except possibly some in Windows.Forms namespace) aren’t nested and it makes it annoying to use for the developer consuming your API, having to prefix the classname.

    One thing that hasn’t been mentioned is that flag enums according to MSDN guidelines should be pluralized nouns which you probably already know (Status is a simple enum so singular nouns should be used).

    State (enum called States) is the vocative, ‘Status’ is the nominative of a noun that the English like most of our language absorbed from Latin. Vocative is what you name a noun for its condition and nominative is the subject of the verb.

    So in other words when the car is moving, that’s the verb – moving is its status. But the car doesn’t go off, its engine does. Nor does it start, the engine does (you probably picked an example here so this might be irrelevant).

    public class Car {   VehicleState _vehicleState= VehicleState.Stationary;    public VehicleState VehicleState    {     get { return _vehicleState; }     set { _vehicleState = value; DoSomething(); }   } }  public enum VehicleState {     Stationary, Idle, Moving } 

    State is such a generalised noun wouldn’t it be better to describe what state it is referring to? Like I did above

    The type example also in my view doesn’t refer to the reader type, but its database. I would prefer it if you were describing the reader’s database product which isn’t necessarily relevant to the type of reader (e.g. the type of reader might be forward only, cached and so on). So

    reader.Database = Databases.Oracle; 

    In reality this never happens as they’re implemented as drivers and an inheritance chain instead of using enums which is why the line above doesn’t look natural.

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

Sidebar

Related Questions

I often find myself asserting that an object isKindOfClass of some class in Objective-C.
I often find myself wanting (and then usually writing) Scalaz type class instances for
I often find myself writing one off queries to either answer someone's question or
I often find myself with a file that has one number per line. I
While striving for const-correctness, I often find myself writing code such as this class
I often find myself wanting to collapse an n-dimensional matrix across one dimension using
I often find myself using lambdas as some sort of local functions to make
I often find myself remembering the name of a class that I want to
I often find myself checking if some value belongs to some set. As I
I often find myself wanting to do something like this, I have something wrapped

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.