Top "Enums" questions

A data type consisting of a set of named values called elements, members or enumerators of the type.

Using Enum values as String literals

What is the best way to use the values stored in an Enum as String literals? For example: public enum …

java string enums
Enum String Name from Value

I have an enum construct like this: public enum EnumDisplayStatus { None = 1, Visible = 2, Hidden = 3, MarkedForDeletion = 4 } In my database, the enumerations are …

c# enums
How to define an enumerated type (enum) in C?

I'm not sure what is the proper syntax for using C enums. I have the following code: enum {RANDOM, IMMEDIATE, …

c enums
JavaScriptSerializer - JSON serialization of enum as string

I have a class that contains an enum property, and upon serializing the object using JavaScriptSerializer, my json result contains …

c# asp.net json enums javascriptserializer
What does the [Flags] Enum Attribute mean in C#?

From time to time I see an enum like the following: [Flags] public enum Options { None = 0, Option1 = 1, Option2 = 2, Option3 = 4, Option4 = 8 } …

c# enums flags
Best way to create enum of strings?

What is the best way to have a enum type represent a set of strings? I tried this: enum Strings{ …

java enums
How to get C# Enum description from value?

I have an enum with Description attributes like this: public enum MyEnum { Name1 = 1, [Description("Here is another")] HereIsAnother = 2, [Description("Last …

c# enums
A 'for' loop to iterate over an enum in Java

I have an enum in Java for the cardinal & intermediate directions: public enum Direction { NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, …

java loops for-loop enums
What is a typedef enum in Objective-C?

I don't think I fundamentally understand what an enum is, and when to use it. For example: typedef enum { kCircle, …

objective-c enums typedef
How to use enums in C++

Suppose we have an enum like the following: enum Days {Saturday, Sunday, Tuesday, Wednesday, Thursday, Friday}; I want to create …

c++ enums