这段代码有什么问题? [英] What is wrong with this code ?

查看:61
本文介绍了这段代码有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这段代码有什么问题?





what is wrong with this code ?


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace enums
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine((byte)Color.Yellow)  ;

                Console.WriteLine((byte)Color.Brown);
            Console.ReadKey();

        }
    }


    enum Color:byte
    { 
    
      Yellow,
      Blue,
      Brown,
      Green
    
    }

    enum Shades:Color
    {
    }
}





我的尝试:



--------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------------------------



What I have tried:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

推荐答案

你的意思是,除了它不编译?

You mean, except that it does not compile?
引用:

错误CS1008:输入byte,sbyte,short,ushort,int ,uint,long或ulong expected

error CS1008: Type byte, sbyte, short, ushort, int, uint, long or ulong expected



枚举,只能声明为保存指定类型的数据...

14.1枚举声明(C#) [ ^ ]


这篇关于这段代码有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆