标题:类型转换问题
取消只看楼主
totsheng
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-1-13
 问题点数:0 回复次数:0 
类型转换问题
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;主要是这句
搜索更多相关主题的帖子: 类型 
2008-09-05 15:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-231604-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.125295 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved