answersLogoWhite

0

What is enum in c sharp?

User Avatar

Anonymous

14y ago
Updated: 8/19/2019

Enum in C#, most of time, are used to defined integer-based values in symbolic ways.

Example - exiting or return codes

Traditionally, when a program exits, it may return an integer value to indicate the status of the execution.

0 everything is OK

1 Something was wrong, but not fatal

2 Fatal Error

public enum ExitCode {

OK = 0, Warning = 1, FatalError = 2

}

... return ExitCode.OK; // old way would by return 0; and one would need to know 0 stands for

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is meant by enum in C programming?

The enum keyword means enumeration.


How do you pass enum object as argument to function in c?

You can't pass an enum as an argument to a function. An enum in C isn't an object, it's a type. All you can do is pass a variable that is of the particular enum's type.


What is difference between C enum and C plus plus enum?

In C++, enum signifies a slightly stronger type than in C. For example, in C, one could write: enum Direction { UP, DOWN }; Direction d = 1; In C++, this would be illegal, only UP or DOWN can be assigned to a variable of type Direction, though there is still implicit casting to integer, so one could still write: int i = UP; Another difference has to do with the way variable are declared in general in C++. In C, once the enum was declared as above, declaring variables of type Direction would have to be done through the enum keyword, like this: enum Direction d = UP; In C++, the name "Direction" becomes a type in itself, so you can write: Direction d = UP;


In c plus plus you cannot assign integer value to enum?

That is correct - In c plus plus you cannot assign integer value to enum - You can only assign an enum value to an enum. Even though an enum looks like an integer, it is not. It is an enum, and C++ implements strict type checking to reduce the probability of bad programming practices. enum ColorCode {black, brown, red, orange, yellow, green, blue, violet, grey, white}; ColorCode myColorCode; myColorCode = yellow; Even though yellow has an integer value of 4, you cannot say myColorCode = 4.


What is new keyword in c?

enum, void and const are relatively new keywords in Cnew, on the other hand, isn't a keyword in C


What are the notes to?

A sharp G G E sharp G E sharp A sharp A sharp C C A sharp C E sharp G A G E sharp A sharp A sharp A sharp G E sharp C this is not on the Flute btw idk what instrument its on


What are the notes to fireflies?

A sharp G G E sharp G E sharp A sharp A sharp C C A sharp C E sharp G A G E sharp A sharp A sharp A sharp G E sharp C this is not on the flute btw idk what instrument its on


How do you play Simpson theme on keyboard?

here it is C,E,F SHARP,A,G,E,C,A,F SHARP,F SHARP,F SHARP,G,A SHARP,C,C,C,C


What is similarity among structure union and enum in c language?

all the three are user defined datatypes


When was Kadhal Enum Nadhiyinile created?

Kadhal Enum Nadhiyinile was created in 1989.


What key signature has G sharp B sharp and C sharp?

C# Major


What are the notes for the c sharp harmonic scale?

C sharp, D sharp, E natural, F sharp, G sharp, A natural, B sharp & C sharp We call the note C "B sharp" to avoid using the same letter name twice. If we used the note name "C" we would have 2 C-notes and no B-notes in the scale!