Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UdemyCSharp
{
    class Program
    { //I get error CS1513 here
        static void Main()
        {
            enum dayofweek { }
        }
    }
} // I get error CS1022 here

What I have tried:

I tried making the Curly Braces where it says to and I get more errors.
Posted
Updated 12-Apr-20 14:03pm

1 solution

C#
class Program
{
    public enum dayofweek { Monday }

    static void Main()
    {
        dayofweek day = dayofweek.Monday;
    }
}


C# doesn't support function-local enum definitions. The closest you can do is make it a public or private nested definition.
 
Share this answer
 
v3

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