如何遍历枚举的所有值?

using System;

namespace PSP
{
    
class GetEnumValues
    
{
        
public static void Main()
        
{
            Type Sexs 
= typeof(SexKind);
            Console.WriteLine(
"The  kinds  of  the  Sex:");
            
foreach (string s in Enum.GetNames(Sexs))
            
{
                Console.WriteLine(s);
            }

        }

    }


    
enum SexKind
    

        Male, 
        Female 
    }

}
  
posted on 2007-10-16 09:32  阿齐  阅读(1876)  评论(0编辑  收藏  举报