Format enum value

image_pdfimage_print
   
  

using System;

enum Color {Yellow = 1, Blue, Green};

class Sample 
{

    public static void Main() 
    {

    Console.WriteLine("Standard Enumeration Format Specifiers");
    Console.WriteLine(
        "(G) General:. . . . . . . . . {0:G}
" +
        "    (default):. . . . . . . . {0} (default = 'G')
" +
        "(F) Flags:. . . . . . . . . . {0:F} (flags or integer)
" +
        "(D) Decimal number: . . . . . {0:D}
" +
        "(X) Hexadecimal:. . . . . . . {0:X}
", 
        Color.Green);       


    }
}

   
    
     


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