enum based on byte : enum base type « Data Type « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

    enum orientation : byte
    {
        north = 1,
        south = 2,
        east = 3,
        west = 4
    }

    class Program
    {
        static void Main(string[] args)
        {
            orientation myDirection = orientation.north;
            Console.WriteLine("myDirection = {0}", myDirection);
        }
    }








2.37.enum base type
2.37.1.Convert enum to int
2.37.2.Assign int value to all elements in an enum
2.37.3.Assign int value to the first element in an enum
2.37.4.Define enumeration base types
2.37.5.Bit Flag Enums
2.37.6.Using Bit flags when declaring the enum
2.37.7.Print out string version of an enum value
2.37.8.Using a base type of long when defining an enum
2.37.9.Using Operators with Enumerations
2.37.10.enum based on byte
2.37.11.enum based on byte, and convert enum variable back to byte