color_arr=(Color[])int_arr; 
这句应该有问题吧,应该对每个元素分别转换

解决方案 »

  1.   


    using System;
    using System.Collections;
    enum Color:short
    {
        Red, 
        Yellow, Blue, Green, Purple, Black, White
    };
    class Test
    {
         static void Main(string [] args)
        {
            for (int i = 0; i < 7; i++)
            {
                Console.WriteLine("The value of color[0] is:{0}", ((Color)i).ToString());
            }
            Console.ReadLine();
        }
    }
      

  2.   

    using System;
    using System.Collections;
    enum Color:short{
      Red,Yellow,Blue,Green,Purple,Black,While
    };
    class Test
    {
      static void Main(string[] args){
        for(int i=0;i<7;i++)
        {
          Console.WriteLine("The value of color[0] is:{0}",((Color)i).Tostring());
        }
         Console.ReadLine();
       }    
    }  
    error CS0117:"Color"并不包含"Tostring"的定义楼上的你的行不通啊,而且和我的问题本义有些不一致哦
      

  3.   

    你问题本义是什么?
    你这个程序想实现什么样的功能
    编译通不过是因为color不是数组,仔细看看错误信息
    Console.WriteLine("The value of color[0] is:{0}",color[0]); 
    Console.WriteLine("The value of color[1] is:{0}",color[1]); 
    Console.WriteLine("The value of color[2] is:{0}",color[2]);