Top "Enums" questions

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

Get int value from enum in C#

I have a class called Questions (plural). In this class there is an enum called Question (singular) which looks like …

c# enums casting int
How can I cast int to enum?

How can an int be cast to an enum in C#?

c# enums casting int
How to get an enum value from a string value in Java?

Say I have an enum which is just public enum Blah { A, B, C, D } and I would like to …

java enums
What is the preferred syntax for defining enums in JavaScript?

What is the preferred syntax for defining enums in JavaScript? Something like: my.namespace.ColorEnum = { RED : 0, GREEN : 1, BLUE : 2 } // later on …

javascript syntax enums
How can I represent an 'Enum' in Python?

I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent …

python python-3.x enums
How to enumerate an enum

How can you enumerate an enum in C#? E.g. the following code does not compile: public enum Suit { Spades, …

c# .net loops enums enumeration
String representation of an Enum

I have the following enumeration: public enum AuthenticationMethod { FORMS = 1, WINDOWSAUTHENTICATION = 2, SINGLESIGNON = 3 } The problem however is that I need the word "…

c# enums
Convert a string to an enum in C#

What's the best way to convert a string to an enumeration value in C#? I have an HTML select tag …

c# string enums
How to loop through all enum values in C#?

This question already has an answer here: How do I enumerate an enum in C#? 26 answers public enum Foos { A, …

c# .net enums language-features
Comparing Java enum members: == or equals()?

I know that Java enums are compiled to classes with private constructors and a bunch of public static members. When …

java enums