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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:22:03+00:00 2026-06-02T05:22:03+00:00

Given the following enum: public enum Operations_PerHourType : byte { Holes = 1, Pieces

  • 0

Given the following enum:

public enum Operations_PerHourType : byte
{
    Holes = 1,
    Pieces = 2,
    Sheets = 3,
    Strips = 4,
    Studs = 5
}

When I run the Microsoft code analysis tool, it tells me:

CA1028 : Microsoft.Design : If possible, make the underlying type of ‘Enums.Operations_PerHourType’ System.Int32 instead of ‘byte’.

It will never have more than a couple possible values, so I declared it as a byte. Why would they recommend using int32? More values for future scalability? Or is there a performance improvement?

  • 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-02T05:22:04+00:00Added an answer on June 2, 2026 at 5:22 am

    Have a look on MSDN for the reason.

    Here is an excerpt:

    An enumeration is a value type that defines a set of related named
    constants. By default, the System.Int32 data type is used to store the
    constant value. Even though you can change this underlying type, it is
    not necessary or recommended for most scenarios. Note that no
    significant performance gain is achieved by using a data type that is
    smaller than Int32. If you cannot use the default data type, you
    should use one of the Common Language System (CLS)-compliant integral
    types, Byte, Int16, Int32, or Int64 to make sure that all values of
    the enumeration can be represented in CLS-compliant programming
    languages.

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

Sidebar

Related Questions

Given the following information Public Enum Request As Byte None = 0 Identity =
Given the following code: public class RMAInfo { public enum RMAStatuses { Undefined =
Given the following flags, [Flags] public enum Operations { add = 1, subtract =
I'm extending an Enum and, given the following code, selectListItems is a generic List
Given the following code: #include <boost/noncopyable.hpp> enum Error { ERR_OK=0 }; struct Filter :
Given the following definitions: public enum SampleEnum1 { Uno, Dos, Tres } public enum
Given the following code: enum Options { Surf = 0x01, Out = 0x02 };
Given the following code, [DataContract] public class TestClass { [DataMember] public object _TestVariable; public
Given the following enum: public enum Position { Quarterback, Runningback, DefensiveEnd, Linebacker }; Is
Given the following java enum: public enum AgeRange { A18TO23 { public String toString()

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.