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

  • Home
  • SEARCH
  • 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 7074263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:01:57+00:00 2026-05-28T06:01:57+00:00

I have a message entity say ( Message ) which can be configured by

  • 0

I have a message entity say (Message) which can be configured by the creator as

  1. IsWebOnly where by it will be shown only on regular website
  2. IsMobileOnly where by it will be shown only on mobile version of the website
  3. The message can also be set to be shown on both forms (regular and mobile) of the website

I want to capture this property as a Nullable boolean. say X

 public class Message {

     public bool? X {get;set;}

     public bool IsMobileMessage { get {return X.HasValue ? !X.Value : true } }

     public bool IsWebMessage {get {return X.HasValue ? X.Value : true} }

   }
  • What would be the most readable name for the property?
  • Should this tri-state be captured with a Enum instead of a nullable boolean?
    • A Nullable boolean seemed to be more attractive to me as there will no further additions to the state of the property.
  • 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-28T06:01:58+00:00Added an answer on May 28, 2026 at 6:01 am

    Should this tri-state be captured with a Enum instead of a nullable
    boolean?

    Absolutely, this would be self-documenting and much easier to maintain – go with an enum. Your current code is confusing at best, just looking at it I have a hard time understanding the logic – I wouldn’t look forward to maintain that code – conventionally a nullable bool would be used to capture true, false and the absence of a value as third state. Re-interpreting the value absence (null) to mean something different is only inviting trouble.

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

Sidebar

Related Questions

I have got an Entity model which contains a collection of Message objects which
I have a MessageThread entity which contains Message entities. The foreign key is set
I have a web service , i add some extra class which have message
I have a message handler, which consumes from a JMS queue and that sends
In C++, a console application can have a message handler in its WinMain procedure,
Let's say you have two kinds, Message and Contact, related by a db.ListProperty of
I'm using LinqToSql classes in an ASP.NET website and let's say I have an
Lets say I have: A username entity, with a Int64 as the ID and
I have about 100 error marker 50 each message. But not every Entity has
What I have Message Entity user | text | date ---------------------------------------------- user1 | 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.