c#遍历枚举

  class   ZZText  
  {  
  enum   Days   {   Saturday,   Sunday,   Monday,   Tuesday,   Wednesday,   Thursday,   Friday   };  
  [STAThread]  
  static   void   Main(string[]   args)  
  {  
  string   []   names   =   Enum.GetNames(typeof(Days));  
  foreach(string   name   in   names)  
  Console.WriteLine(name);  
  Console.ReadLine();  
  }  
  }  
  //输出如下  
  Saturday  
  Sunday  
  Monday  
  Tuesday  
  Wednesday  
  Thursday  
  Friday

你可能感兴趣的:(String,C#,Class)