Questions tagged [enums]

0 votes
1 replies
Typescript Enum Object.values() return value
Why does Object.values() and Object.keys() always give both the keys and the values? Consider the following code: enum Enum { FOO, BAR...
asked 1 month ago
3 votes
2 replies
Typescript enum values as array
Is it possible to get the values of an enum in TypeScript as an array? Like this: enum MyEnum { FOO = 'foo', BAR = 'bar' } becomes [...
asked 1 month ago
0 votes
0 replies
How get values from ENUM field in sql table? [duplicate]
I want to populate my dropdowns with enum possible values from a DB automatically. Is this possible in MySQL? 88 23 Answers...
asked 1 month ago
0 votes
0 replies
Bind the enum System.IO.WatcherChangeTypes to a ComboBox Itemsource [duplicate]
I am trying to find a simple example where the enums are shown as is. All examples I have seen tries to add nice looking display strings but I do...
asked 1 month ago
0 votes
0 replies
Check for single case inequality on Swift associated enum? Error: “Variable binding in a condition requires an initializer” [duplicate]
I have an enum: enum E { case A, B, C(Int) } let a: E = .A Here's how I would check if a equals .B if case .B = a { // works fine }...
asked 1 month ago
-1 votes
1 replies
How can I set (with setter method) an enum property from a class when I make an object in java
enum SateBook { AMANAT, SAHAFI, AMADE; } //public class Book private SateBook st; private SateBook stBok; private int price;...
asked 1 month ago
0 votes
0 replies
How to handle same multiple key in translation DB Enum Yii Extension
I just added the enum extension to an old project I'm working on, following the guide/documentation I ran into a problem that concerns the transl...
asked 1 month ago
0 votes
1 replies
Can enum cases contain a list of classes?
Can an enum contain a list of classes? I have a superclass Activity: SKScene { }, which has sub-private class Activity01: Activity { }, sub-priv...
asked 1 month ago
-1 votes
0 replies
Expected expression before 'enum' [duplicate]
I have created a .h file in C that contains a enum 'app'. This enum value need to be accessed in the main.c program. My code looks something like...
asked 1 month ago
0 votes
1 replies
Creating dynamic method overload based on a specified enumeration value
I want to create a method overload based on the specified enum-value. I´ve the following method-construct: public void InsertValue(DataType dat...
asked 1 month ago
-2 votes
1 replies
Best way to have nested enums in Kotlin?
So in Swift you can do something like: public enum OuterEnum { public enum InnerEnum { ... } } What would the equivalent be in...
asked 1 month ago
0 votes
1 replies
Localizable enum in swift using R.Swift library
I have such enums: enum Gender { case male case female func toString() -> String { switch self { case .male:...
asked 1 month ago
1 votes
0 replies
Can I create Python Enums for conversion rates?
I currently have two Django models defined for DataUnit (ex. kWh, $, day, month, etc.) and RateUnit (ex. $/day, $/kWh, etc.). This is proving he...
asked 1 month ago
0 votes
1 replies
enum field not being properly retrieved ActiveRecord
I'm having some issues using ActiveRecord's enums in a Rails application. Context: The enum field represents the status of an object, for the sa...
asked 1 month ago
0 votes
1 replies
How to create a Field-Less Enum variant from its discriminant? [duplicate]
This question already has an answer here: How do I match enum values with an integer?...
asked 1 month ago
2 votes
2 replies
How to access Enum of arrays
I have two sets of Products public enum ProductType { FOUNDATION_OR_PAYMENT ("946", "949", "966"), NOVA_L_S_OR_SESAM ("907", "222");...
asked 1 month ago
-1 votes
0 replies
Java enum static imports not required? [duplicate]
Say I have an Enum as follows: package stackoverflow.models; public enum MyEnum { VALUE_1, VALUE_2; } And then I have a POJO which ha...
asked 1 month ago
0 votes
0 replies
How to bind DropDownList to Enum in ASP.NET MVC [duplicate]
I'm trying to use the Html.DropDownList extension method but can't figure out how to use it with an enumeration. Let's say I have an enumeration...
asked 1 month ago
1 votes
2 replies
How can i set glm::vec3(1.f, 0.f, 0.f) as a value of an enum?
I want to have an enum wich contains glm::vec3 "constants". Currently i have an enum called "Axis", wich containts X, Y and Z. and everytime i u...
asked 1 month ago
0 votes
2 replies
Q_ENUMS with enum in header file
I want to use the elements of an enum as items in a QComboBox. I can do so if the enum is defined in the same class but I would like to use an en...
asked 1 month ago
2 votes
2 replies
How to change the base value of auto in python Enum?
Assuming I have the following code, how can I change the base value of auto so that Animal.ant is an arbitrary value, e.g. 10, rather than 1? fr...
asked 1 month ago
0 votes
1 replies
How to verify if a variable is Enum?
I wish to check if a variable is a valid Google App Script Enum type. function myFunc(BORDER_COLOR) { if (typeof BORDER_COLOR !== "Enum") {...
1 votes
1 replies
How do I use float enums with a Jcombobox in Java
I have an enum class that uses floats for its values e.g. public enum Size { SMALL(10.50f),MEDIUM(12.35f),LARGE(15.90f); private float...
asked 1 month ago
1 votes
0 replies
Cannot move out of an 'Rc'
Deriving PartialEq on an enum with a unit variant of an Rc trait object seems to trigger a Cannot move out of an 'Rc' error. I've been able to c...
asked 1 month ago
0 votes
1 replies
Best way to extract all enums from C project
I'm writing my own enums-based backtrace. Basically each function call will append it's error to a pre-defined stack which will eventually includ...
asked 1 month ago