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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:11:30+00:00 2026-05-27T08:11:30+00:00

It says here that the possible types for an enum are byte , sbyte

  • 0

It says here that the possible types for an enum are byte, sbyte, short, ushort, int, uint, long, or ulong.

What if I need a float or a double to define percentage increments such as 1.5 or 2.5 for example? Am I stuck?

As said here:
http://en.csharp-online.net/.NET_Type_Design_Guidelines%E2%80%94Enum_Design

An enum is a structure with a set of static constants. The reason to
follow this guideline is because you will get some additional compiler
and reflection support if you define an enum versus manually defining
a structure with static constants.

Since an enum is a set of constants, why can’t I have float constants ?

Update: it is said here:
http://en.csharp-online.net/.NET_Type_Design_Guidelines%E2%80%94Enum_Design
“Did you know that the CLR supports enums with an underlying type of float or double even though most languages don’t choose to expose it?”

Since I’m only using c# is there a way to do so with some hacks ?

  • 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-27T08:11:30+00:00Added an answer on May 27, 2026 at 8:11 am

    Although the CLR itself supports floating point enums, C# designers chose not to expose this in the language (see http://en.csharp-online.net/.NET_Type_Design_Guidelines%E2%80%94Enum_Design). You can either use constants as in John Saunders’ answer, or you can define an integer enum with multiplied values and then divide them back if/when you need the value.

    The use case would be definitely interesting, though. Why do you need/want this?

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

Sidebar

Related Questions

While designing a table my colleague here says that I should avoid identity column
I recently found a log statement in my projects codebase that says here i
The title pretty much says it. I have some methods that need to run
Documentation can be found here It says in the example: onDrop: Called whenever a
Here's one from the No question's too dumb department: Well, as the subject says:
like 1 image says more than 1000 words. here is what I want to
I was wondering about the last constructor for std::string mentioned here . It says:
OK, I don't think the title says it right... but here goes: I have
Sorry for the confusing title, but it basically says it all. Here's the structures
I have an incredibly simple query (table type InnoDb) and EXPLAIN says that MySQL

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.