Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
what is wrong with this code ?


C#
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:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Posted
Updated 9-Nov-16 19:35pm
Comments
Karthik_Mahalingam 10-Nov-16 4:02am    
remove this, since you are not using it.
enum Shades:Color
{
}
this answers your question.

1 solution

You mean, except that it does not compile?
Quote:
error CS1008: Type byte, sbyte, short, ushort, int, uint, long or ulong expected

Enums, can only be declared to hold data of specified types...
14.1 Enum declarations (C#)[^]
 
Share this answer
 
Comments
forte74 10-Nov-16 18:35pm    
yes... what is that error mean

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900