类型转换问题
enum Color{
Red,Yellow,Blue,Green,Black,White
}
class Program
{
static void Main(string[] args)
{
Color[] color_arr = new Color[3];
int[] int_arr = new int[] { 1, 2, 3 };
color_arr = (Color[])int_arr;
Console.WriteLine("color is {0}", color_arr[0]);
Console.WriteLine("color is {1}", color_arr[1]);
Console.WriteLine("color is {2}", color_arr[2]);
Console.Read();
}
}
怎么转换
color_arr = (Color[])int_arr;主要是这句