Most voted "enums" questions
A type of data consisting of a set of named values, called elements, members or Enumerators of the type. The tag can be used whenever this data type is used language-independent. Do not use Enum-java or other variation to indicate that it is about the Enum of a language. The individual tag of the language will indicate this.
Learn more…115 questions
Sort by count of
-
2
votes2
answers3265
viewsHow to go through Enum in Java
I have the following Enum: public enum TipoPokemon { FIRE("FIRE"), WATER("WATER"), GRASS("GRASS"), ELECTRIC("ELECTRIC"), ICE("ICE"), DARK("DARK"), GHOST("GHOST"), FAIRY("FAIRY"), PSYCHIC("PSYCHIC"),…
-
2
votes1
answer241
viewsHow to increment an Enum in C?
Objectively as I do to increment ++ or += 1 one of the variables of enum (the increment will be in a loop / switch): enum {um = 0, dois = 0 ... seis = 0}; I read that one question and I didn’t get…
-
2
votes1
answer86
viewsDoes not accept Enum parameter with non-zero integer
Follows code: class Program { public enum Enum { Casa = 0, Apartamento = 5 } public static string MinhaFuncao(Enum @enum) => "MinhaFuncao"; static void Main(string[] args) { var r =…
-
2
votes1
answer485
viewsConversion from Enum to string
Good afternoon! I have the following situation, as return of a request I receive a json with various information. In c# convert this information to objects using Jsonconvert.Deserialize().. Look at…
-
2
votes1
answer129
viewsInstantiating generic type of an Enum
I would like to instantiate a class from an Enum, for example: Instead of doing: var classeGenerica; if (viewModel.tipoCarro == 1) classeGenerica = new classeCarro(); else classeGenerica = new…
-
2
votes4
answers140
views"Enum" should be used to indicate business rule options?
Let me give you an example that is better: in the supermarket there are several categories of products such as vegetables, canned vegetables and others. To register more enumDo I have to change the…
-
2
votes1
answer178
viewsIf in C# "Enum"s only accept whole types, why accept a "char"?
When we’re learning about enums in C# is said to accept only integer numeric types. Therefore, we soon think of sbyte, byte, short, ushort, int, uint, long or ulong. But the code below also works,…
-
2
votes2
answers46
viewsEnum initialization
I’ve always created enums thus: public enum TipoTelefone { Residencial, Celular, Comercial } But today giving maintenance on a code I found one like this: public enum TipoTelefone { Residencial = 0,…
-
2
votes1
answer26
viewsAccess method of type String with Reflection
I have the following class of Enum: public enum Teste { TESTE( 101, "Teste" ), MUNDO( 601, "Mundo" ); private final String descricao; private final int codigo; Teste( int codigo, String descricao )…
-
2
votes1
answer93
viewsIs it possible to pass an Enum value on your call?
I created in Java a enum for mass measurement units and need the user to pass a value when using it. For example: enum Weight { KILOGRAMS, POUNDS; private float value; Weight(float value) {…
-
1
votes1
answer52
viewsEnumerator Random
I’m having trouble making an enumerator tube. enum Notas {A=10, B=22, C=31, D=44, E=56}; There is this solution, but I need the values of the Enumerators and here it is returning the rest of the…
-
1
votes3
answers808
viewsSpring MVC Enum
I would like a help, I am new with Spring MVC and I am trying to send a numeral value of an Enum that I own in my class, but I am not succeeding, it is only accepted the Nominal value. I’d like some…
-
1
votes2
answers1002
viewsReturn Enum C#
I have the following: public enum TNFeInfNFeDetImpostoICMSICMS00CST { /// <remarks/> [System.Xml.Serialization.XmlEnumAttribute("00")] item00 = 00, } How do I "take" the "00" value of the Enum…
-
1
votes3
answers1411
viewsCompare an integer typed with each Enum value
Hello. I want to check if the option that the user typed corresponds to an option in the menu. I’m using Enum to show the options and the user type a corresponding number. But I can’t. Let’s see the…
-
1
votes1
answer49
views -
1
votes1
answer33
viewsUnidentified tenum in html
I created the following helper: public static HtmlString DropDownListEnum<TEnum>(this HtmlHelper htmlHelper, string name, int? valorSelecionado = null) { List<SelectListItem> lstEnum =…
-
1
votes1
answer79
viewscalling Enum for value
I created an Enum: public enum EnumTipoBoleto { VazioErro=0, ConfigInicial = 1, Mensalidade = 2, Outros =3, DifMensal =4 } Now in some places I have the number and want to convert to Enum var…
-
1
votes1
answer297
views -
1
votes1
answer123
viewsSelect sex with Enum
I made the field select sex that way: model: enum sexo: [:feminino, :masculino, :desconhecido] def self.sexes_for_select sexos.keys.map{ |x| [x.humanize, x] } end form: <%= f.select :sexo,…
-
1
votes3
answers712
viewsCompare string to Enum, inside the lambda?
the problem is: I have a dropdownlist loaded from an Enum, which can come with the null value of the screen. listaItensSolicitados = os.Site == null ? this.itemSolicitadoService.Consultar(o =>…
-
1
votes1
answer561
viewsUsing enums in java
I created an Enum and I need to set the values in the bank that way: If it is Revenue, the value is 0; If it is Expense, the value is 1; This is my Enum: public enum EntryType { INCOME, OUTPUT; } In…
-
1
votes2
answers1828
viewsLearning to use ENUM in Java
Good afternoon. I’m learning to use the guys enum in Java and facing some problems. First of all, I created my own enum as follows: public enum enumUpdateAction { NEW(0), CHANGE(1), DELETE(2),…
-
1
votes2
answers2646
viewsHow to take an ENUM constant for the entire value?
I have an Enum that represents the months: public enum Mes { Janeiro, Fevereiro, Marco, ... } How do I get the month description for the entire amount? E.g.: Enter with 12 and return December…
-
1
votes1
answer70
viewsShare on a web service with the client
I created a web service where there are numerators to keep track of an attribute of the whole type, I would like to know how to access this enumerator of another project in which I am using this web…
-
1
votes1
answer294
viewsDisplay Name with Razor
I have this case in my project? public enum TipoValorCalculoComissao { [Display(Name = "Percentual")] Percentual = 1, [Display(Name = "Valor")] Valor = 2 } And I would like to put these values in a…
-
1
votes0
answers101
viewsFunction with Enum - TYPESCRIPT
Good need to put a function in an Enum in typescript as in the example below: export enum dataTableFunc{ 'edit'= teste() } function teste(event.button){ // } In this Function that I am trying to…
-
1
votes2
answers245
views -
1
votes1
answer992
viewsCheck if there is value in the enumeration by the attribute and return its value
It is possible to produce simpler code for this function without changing the enum? /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]…
-
1
votes1
answer383
viewsPython - What is Enum?
I used the type function on an object and the returned was: <enum 'Button'>. What does that mean?
-
1
votes1
answer632
viewsRadio input check - Javascript
I need to verify which of 3 different Radios is selected for a check. <input type="radio" name="frame" id="framework" value="react"> React <input type="radio" name="frame" id="framework"…
-
1
votes2
answers456
viewsString Field List Sorting
I have a List with attributes, of which I have the field of reviews, containing: Excellent, Good, Regular, Bad, and Bad. The information for this field I get from the consumption of a REST API using…
-
1
votes1
answer139
viewsHow to get string from Enum on an ASP.MVC grid
I have the following: public enum RegiaoEnum { CENTRO = 1, NORTE = 2, SUL = 3, SUDESTE = 4, CENTROOESTE = 5 } And the following View: @using MeuDominio.Enums; <div class="animate"> <table…
-
1
votes1
answer39
viewsIncompatible types when trying to start a class with the "switch" value of another Java
I got the following: public class Bullet { public enum Direcao { UP,DOWN,LEFT,RIGHT }; // Posição do tiro em pixels. private int x,y; // Direção do tiro. private Direcao direção; // Este tiro está…
-
1
votes1
answer108
viewsHow to convert Enum to int by filling with zero on the left?
Ladies and gentlemen, I have a question here of converting a enum in a string, but I need the conversion to be filled with zero to keep 2 digits. Example public enum System { Unknown = 0, Mirror =…
-
1
votes1
answer261
viewsHow to write an Enum to the database with JPA and Postman
I am creating a product register, and when I pass through Postman the JSON of my product to be recorded, its type is being saved as NULL. The product types are an Enum, I will put down the code I…
-
0
votes1
answer985
viewsENUM returning only key and not value
I am trying in various ways to get the value of an ENUM, but it just returns its "key". Below follows the ENUM: public enum SaleType { BOUGHT("Comprou"), SEND_BUDGET("Enviar Orçamento"),…
-
0
votes1
answer219
viewsSort by ENUM Mysql value
I have a question and since I did not find anything on the internet I decided to ask you, well, I have a Mysql table and this table contains an ENUM field that can be 'yes' or 'no', I wonder if it…
-
0
votes1
answer169
viewsInternationalization with Enums Labels
Hello I’m trying to do internationalization with Labels from an Enum: public enum WeekDay { MONDAY("msg.week_monday", "mon"), TUESDAY("msg.week_tuesday", "tue"), WEDNESDAY("msg.week_wednesday",…
-
0
votes1
answer438
views -
0
votes1
answer144
viewsColor status in gridview Asp.net C#
I need to make the text of the exam status of an app appear in different colors, in case wait black, marked green and not performed in red, these status are in an Enum. Follow my code, if anyone…
-
0
votes1
answer91
viewsEnum me returning null Pointer
My Enum is returning Null Pointer when re-running this call: System.out.println(DefinicaoSCM.getDefinicaoSCMPorDisciplina(Disciplina.IMPLEMENTACAO)); Implementation: public enum DefinicaoSCM {…
-
0
votes1
answer192
viewsHow to use Enum with Entityframework
I have a relationship in my system where one class has a relationship with another, but this other class is nowhere in the system to change/delete its state (are only static data). I wonder if the…
-
0
votes2
answers397
viewsUse of Enum in the case of a switch
Hello, good afternoon. I have a problem regarding the use of ENUM to replace a number in the case. In order to make my code more intuitive and not use numbers in switch cases, I intend to use an…
-
0
votes0
answers173
viewsSend ENUM parameter to C# via Javascript
I am developing a project in which I have to consume a Web Service in . NET that requires an object with some parameters of type Enum. The call is made by Javascript as below: function…
-
0
votes1
answer524
viewsHow to save a custom Enum name in the database?
I have an Enum Type which has a JURIDICAL person and a PHYSICAL person. I created a custom name (Legal) and (Physical). I’m getting to appear on the screen the custom name, but in the database is…
-
0
votes1
answer95
viewsEnumeration Swift 4 - What is its usefulness and how does it work for IOS development?
Good guys, I’m studying hard to start developing an app in Swift 4 for a job interview, but the Type Enum left me a little, almost nothing, however, still confused. I wanted to know a little more…
-
0
votes1
answer108
viewsHow to assign number to the name Enum Typescript?
All right, guys ? Can anyone help me with this problem in Typescript 2.3. Problem: My back-end sends me a property in Json with value 00 or 01, I need to convert to Regular or Extra. However I can…
-
0
votes2
answers585
viewsJsonresult display Displayname from an Enum
I’m having a problem returning the Displayname of an Enum I have the following Enum public enum TipoPessoa { [Description("Pessoa Fisica")] [Display(Name = "Pessoa Fisica")] [JsonProperty("Pessoa…
-
0
votes1
answer166
viewsUse of Enum within a Struct
Good evening. I have to do a program where I have to create several elements using the following: typedef enum {ATRIB, ADD, SUB, MUL, IF_I, PRINT, READ, GOTO_I, LABEL} OpKind; typedef enum {EMPTY,…
-
0
votes1
answer186
viewscould not Convert | Error returning object
The purpose of the code below is to return the tokens of a particular expression, for example: 50+30*(30-10)+(10/2). Where the tokens would be: [number, 50], [sum, +], [number, 30], [mult,*] and so…