• 遍历枚举类型


    using  System; 

    public  class  EnumTest  { 
           enum  Days  {  Saturday,  Sunday,  Monday,  Tuesday,  Wednesday,  Thursday,  Friday  }; 

           public  static  void  Main()  { 

                   Type  weekdays  =  typeof(Days); 

                   Console.WriteLine("The  days  of  the  week,  and  their  corresponding  values  in  the  Days  Enum  are:"); 

                   foreach  (  string  s  in  Enum.GetNames(weekdays)  ) 
                           Console.WriteLine(  "{0,-11}=  {1}",  s,  Enum.Format(  weekdays,  Enum.Parse(weekdays,  s),  "d")); 
           } 

  • 相关阅读:
    销售类
    语法
    编辑技巧 word
    assert
    游戏摘录
    游戏类链接 财富导图
    读书笔记之C# delegate
    c# socket传输struct类型
    关于wcf中一些重要词语解释
    asp.net CROSS-PAGE POSTING
  • 原文地址:https://www.cnblogs.com/bile/p/2737383.html
Copyright © 2020-2023  润新知