孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

C#中枚举类型用Enum表示

class Example2_10
{

    enum Planets
    {
        Mercury = 1,
        Venus,
        Earth,
        Mars,
        Jupiter,
        Saturn,
        Uranus,
        Neptune,
        Pluto
    }

    public static void Main()
    {

        System.Console.WriteLine("Position of Earth = " +
          (int)Planets.Earth);

        System.Console.WriteLine("Planets.Earth = " +
          Planets.Earth);
        string i = System.Console.ReadLine();
    }

}

posted on 2011-05-03 20:25  孤独的猫  阅读(120)  评论(0编辑  收藏  举报