Hi all,
The following does work, but not as I expected.
If I use an enum I normally don't have to prefix it with a class name.
Here it seems the only option. Can anyone tell me why?

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            MyEnums E = new MyEnums();
            // Why do I have to use this instead of E.Pets
            // or simply Pets.cat;?
            // Looks like some static behaviour, but I don't understand why...
            E.P = MyEnums.Pets.cat;
        }
    }

    class MyEnums
    {
        public enum Pets
        {
            cat,dog,tiger
        }

        public Pets P;
    }
}

You declared the Enum inside of a class. You can declare enums directly in the namespace like you're accustomed to:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace daniweb
{
  public partial class frmEnums : Form
  {
    public frmEnums()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      GlobalEnum ge = GlobalEnum.Value1;
      OrganizationalClass.ClassEnum ce = OrganizationalClass.ClassEnum.Value1;
    }
  }

  public enum GlobalEnum
  {
    Value1,
    Value2
  }

  public static class OrganizationalClass
  {
    public enum ClassEnum
    {
      Value1,
      Value2
    }
  }
}
This question has already been answered. Start a new discussion instead.