Re: How big is an enum?

From: Tom Tanner (tom_tanner_at_3com.com)
Date: 10/17/03


Date: Fri, 17 Oct 2003 09:23:07 +0100


unix_mathi wrote:
> Enums are integers.So it occupies 4 bytes.

(Cutting in at the end of the conversation) They /could/ be smaller. The
compiler is entitled to store an enum in a short or a byte of the enum
range is appropriate. (Not that many do).

Tom



Relevant Pages

  • Collection of Enum with additional properties
    ... I was to track some additional properties around an enum I have - for ... I also need to be able to store and manage a collection of these ... EnumDescriptor objects... ... collection class by inheriting from the the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: BIT banging help
    ...  how many enum values can I store with a long? ... store as a bigint in sqlserver). ... I want to be able to AND and OR each permission enum value, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: how to parse an Enum Structure in vb.net
    ... Storing the names is something that should be considered in some cases, ... In other cases the names have no natural numbering at all, then it might be better to store the names. ... You can just as easily assign numbers to each enum value, i.e., ... Filibuster = 25 ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Enum
    ... So trying to store both ... Required and Validate in a variable declared as Mode is like trying to ... You are going to need a third item in the Enum. ... RequiredValidate? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: BIT banging help
    ... store as a bigint in sqlserver). ... the answer to "how many enum values can I store with a long" is trivial to answer. ...
    (microsoft.public.dotnet.languages.csharp)