C#编程(4_复杂的变量类型)
2020-12-13 13:59
标签:style blog color io os ar sp div on 举例: C#编程(4_复杂的变量类型) 标签:style blog color io os ar sp div on 原文地址:http://www.cnblogs.com/haizhibin1989/p/4051346.html
enum
namespace ConsoleApplication1
{
enum orientation : byte
{
north=1,
south=2,
east=3,
west=4,
}
class Program
{
static void Main(string[] args)
{
byte directionByte;
string directionString;
orientation myDirection = orientation.north;
Console.WriteLine("myDirection={0}",myDirection);
directionByte = (byte)myDirection;
directionString = Convert.ToString(myDirection);
Console.WriteLine("byte equivalent={0}",directionByte);
Console.WriteLine("string equivalent={0}", directionString);
Console.ReadKey();
}
}
}
下一篇:面试题整理----Java基础