Top "Enums" questions

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

How to get a enum value from string in C#?

I have an enum: public enum baseKey : uint { HKEY_CLASSES_ROOT = 0x80000000, HKEY_CURRENT_USER = 0x80000001, HKEY_LOCAL_MACHINE = 0x80000002, …

c# enums
How do I select a random value from an enumeration?

Given an arbitrary enumeration in C#, how do I select a random value? (I did not find this very basic …

c# random enums
How to test enum types?

I'm currently trying to build a more or less complete set of unit tests for a small library. Since we …

unit-testing enums hamcrest
How to TryParse for Enum value?

I want to write a function which can validate a given value (passed as a string) against possible values of …

c# enums
How to model type-safe enum types?

Scala doesn't have type-safe enums like Java has. Given a set of related constants, what would be the best way …

scala enums
Easy way to use variables of enum types as string in C?

Here's what I am trying to do: typedef enum { ONE, TWO, THREE } Numbers; I am trying to write a function …

c enums c-preprocessor
How can I output the value of an enum class in C++11

How can I output the value of an enum class in C++11? In C++03 it's like this: #include <iostream&…

c++ c++11 templates enums enum-class
Ways to save enums in database

What is the best way to save enums into a database? I know Java provides name() and valueOf() methods to …

java database enums
Convert an enum to List<string>

How do I convert the following Enum to a List of strings? [Flags] public enum DataSourceTypes { None = 0, Grid = 1, ExcelFile = 2, ODBC = 4 }; …

c# .net enums generic-list
How to get all values from python enum class?

I'm using Enum4 library to create an enum class as follows: class Color(Enum): RED = 1 BLUE = 2 I want to print [1, 2] …

python enums