This is probably a stupid question, but I can\'t seem to do it. I want to set up some enums in one class like this:
public enum Direction { north, east, south,
Put the enum
definition inside of the Program.cs
file, but outside of the Program
class. This will make the enum
type globally accessible without having to reference the class name.
namespace YourApp
{
enum Direction { north, east, south, west };
static class Program
{
}
}
Then you can access it anywhere in any class within the same namespace without the need to specify the class name like this:
Direction d;
d = Direction.north;