Questions tagged as 'enums'

1
answer

Why and when to use enum in Java?

Someone learning the language, novice or experienced, may never have come across Java enumerations. I have read on several occasions that they are useful, for example, to implement singleton standards with more guarantees of visibility between...
asked by 25.02.2014 / 23:17
6
answers

How to go through an enum?

I need to do the following: Pass a string and go through it and take each letter found and add with its corresponding value, type: a = 1, s = 19 and so on. Well, I made a enum with all values of string , starting with a =...
asked by 06.07.2015 / 12:34
1
answer

What is the advantage of using the ENUM type?

When I use type ENUM because until today where I saw this type being used it could be replaced with VARCHAR or even with a simple CHAR , I can not see a case where it really is needed ? A practical example would be useful.  ...
asked by 21.08.2015 / 13:01
4
answers

How do I assign a value to an enum with binary notation?

To work with hexadecimal numbers, just add 0x in front of the number, like this: var numeroHexa = 0xff1120; The same goes for octal numbers, adding 0 : var numeroOct = 037; But how do you declare binary numbers? var nume...
asked by 23.04.2014 / 15:53
2
answers

How to create methods in an enum?

I have a Java application and I'm porting it to C #. I have a question regarding enum that seems to work differently than Java. After you have asked a question here on the site ( Enumerations can contain abstract methods? ), whenever poss...
asked by 17.04.2016 / 06:54
2
answers

How to get the integer value of one of the constants of an enum?

I have an enum (enumeration) calling Notas and I need to get the integer corresponding to one of its constants. public enum Nota { Otimo = 5, MuitoBom = 4, Bom = 3, Regular = 2, Ruim = 1, Insuficiente = 0 } I...
asked by 15.12.2013 / 03:22
1
answer

Is it possible to work with Javascript Enumerators?

Commonly used in many languages Enumerators make life easier for developers when creating a "list" of constant values within an application. Within Javascript is it possible to use this structure?     
asked by 29.09.2017 / 19:35
1
answer

Convert int or string to enum

How to convert variables from types int and string to enum ?     
asked by 13.11.2015 / 14:52
1
answer

What does the "OR" operator do in an Enum?

What does the logical operator | (or) do in that Enum? public enum Status { Running = 1, Inactive = 2, Error = Inactive | Running }     
asked by 10.07.2014 / 21:19
2
answers

Values of an Enum can only be integers?

Studying C #, I came across a situation, I want to get a value ( string ) from the console. And then compares it with the value of an enum . For example: [Serializable] public enum Command { Exit = "/exit", SendMessage...
asked by 26.06.2015 / 17:06