Hello, I'm a beginner in these to programming language. Here I want to know how to display the actual value of variable of enum holds. Like this in C++:
#include <iostream>
#include <conio.h>
using namespace std;
int main(void)
{
enum Difficulty
{
Low = 1,
Medium,
High
};
Difficulty myDiff = High;
cout << "Difficulty: " << myDiff << endl; //it displays the value is 3
_getch();
}[/B]
but in C#:
using System;
public enum Difficulty : byte
{
Low = 1,
Medium,
High
}
class enumProgram
{
public static void Main(string[] args)
{
Difficulty myDiff = Difficulty.High;
Console.WriteLine("High = {0}", myDiff); //it displays High instead of 3
Console.ReadLine();
}
}
How to display the value 3 instead of High in C#?