Enum Parse

image_pdfimage_print
   
   

using System;

enum EmpType : byte {
    Manager = 10,
    Grunt = 1,
    Contractor = 100,
    VP = 9
}

class Program {
    static void Main(string[] args) {
        EmpType fred;
        fred = EmpType.VP;

        EmpType sally = (EmpType)Enum.Parse(typeof(EmpType), "Manager");
        Console.WriteLine("Sally is a {0}", sally.ToString());
    }
}

   
    
     


This entry was posted in Data Types. Bookmark the permalink.