Format enum : Enum format « Data Types « C# / C Sharp






Format enum

    
using System;

class MainClass{
   public static void Main(){  

        DayOfWeek thisDay = DayOfWeek.Monday;
        string[] formatStrings = {"G", "F", "D", "X"};
        
        foreach (string formatString in formatStrings)
           Console.WriteLine(thisDay.ToString(formatString));
   }
}
/*

Monday
Monday
1
00000001


*/        

   
    
    
    
  








Related examples in the same category

1.Enum format: "G", "F", "D", "X"
2.Format Enum as string
3.Get a collection of flags from a flag value.