枚举小例子

       

public enum Color
    {
        Red=1,
        Green=2,
        Blue=3

    }

 

            Color red = Color.Red;
            Console.WriteLine(red);//Red;
            Console.WriteLine(Color.Green);//Green
            Console.WriteLine(red.GetType());//CustomLib.Color
            Console.WriteLine((int)red);//1
            //Console.WriteLine(Color);//error Color is type
            //Console.WriteLine(Player);//error Player is type

posted @ 2013-03-26 11:56  Predator  阅读(115)  评论(0编辑  收藏  举报