Top "Enums" questions

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

Enum ToString with user friendly strings

My enum consists of the following values: private enum PublishStatusses{ NotCompleted, Completed, Error }; I want to be able to output …

c# enums tostring
Why is enum class preferred over plain enum?

I heard a few people recommending to use enum classes in C++ because of their type safety. But what does …

c++ class enums c++-faq
How to cast int to enum in C++?

How do I cast an int to an enum in C++? For example: enum Test { A, B }; int a = 1; How …

c++ casting enums
Cast Int to enum in Java

What is the correct way to cast an Int to an enum in Java given the following enum? public enum …

java casting enums ordinal
How to convert enum value to int?

I have a function which return a type int. However, I only have a value of the TAX enumeration. How …

java enums
Java using enum with switch statement

I've looked at various Q&As on SO similar to this question but haven't found a solution. What I …

java enums switch-statement
Jackson enum Serializing and DeSerializer

I'm using JAVA 1.6 and Jackson 1.9.9 I've got an enum public enum Event { FORGOT_PASSWORD("forgot password"); private final String value; …

java enums jackson jsonserializer
How can I lookup a Java enum from its String value?

I would like to lookup an enum from its string value (or possibly any other value). I've tried the following …

java enums lookup
Can I set enum start value in Java?

I use the enum to make a few constants: enum ids {OPEN, CLOSE}; the OPEN value is zero, but I …

java enums
Declaring an enum within a class

In the following code snippet, the Color enum is declared within the Car class in order to limit the scope …

c++ class enums namespaces scope