namespace EnumAndStructDemo
{

//定义枚举
    enum orientaton : byte(枚举中值的类型)
    {
        north=5,
        south=4,
        ease,
        west
    }

//定义结构
    struct route
    {
       public orientaton oo;
       public double d;
    }
    class Program
    {
        static void Main(string[] args)
        {
            byte a = 4;
            int b;
           
            orientaton o = (orientaton)a;
            route r;
            r.d = 12.2;
            r.oo = orientaton.west;
            Console.WriteLine("You select orientaton is {0}",o);
            Console.WriteLine("You select orientaton value is {0}", Convert.ToByte(o));
            Console.WriteLine("You select route's orientation  is {0} and distiace is {1}",r.oo,r.d);
            Console.ReadKey();
        }
     
    }
}

posted on 2009-11-22 20:18  新小白龙  阅读(224)  评论(1编辑  收藏  举报