How to Convert Enum to Integer in C# ?

Below is a sample sourcecode that demonstrates how to Convert Enum to Integer in C# ?

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{  
    class Program
    {
        static void Main(string[] args)
        {
            int enumInt = (int)Designation.SoftwareEngineer;
            Console.WriteLine(enumInt.ToString());   

            Console.ReadLine();
        }
        enum Designation
        {
            SoftwareEngineer = 1 ,
            TraineeEngineer = 2 ,
            Architect = 10
        }
    }
}