C# Programming - Enumerations - Discussion

Discussion Forum : Enumerations - General Questions (Q.No. 3)
3.
Which of the following statements is true about an enum used in C#.NET?
An implicit cast is needed to convert from enum type to an integral type.
An enum variable cannot have a public access modifier.
An enum variable cannot have a private access modifier.
An enum variable can be defined inside a class or a namespace.
An enum variable cannot have a protected access modifier.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
4 comments Page 1 of 1.

Ataman said:   4 years ago
@Nagaraju Kuricheti,

You did it in an explicit way.

Explicit casting.
double myDouble = 9.78;
int myInt = (int) myDouble;

Nagaraju Kuricheti said:   8 years ago
Yes, option A is also true.

We need to convert it implicitly.
int a=(int)enum_name.Namedintegerconstant;.

Rama Lanka said:   9 years ago
But also option A is true. Isn't it?

Bhupendra singh said:   1 decade ago
We can define a enum at both place, either inside a namespace or inside class, it will work properly.

Option b, d, e is wrong because we can use access modifier with enum.

Post your comments here:

Your comments will be displayed after verification.