Q: enum

  • Thread starter Thread starter Geoff Jones
  • Start date Start date
G

Geoff Jones

Hiya

I've just started experimenting with C# and have a problem with enum. I have
created an enumeration as follows:

enum Boxes {small, large};

I've placed this just after the namespace qualifier of the Box class (see
below)

I have a class, called for example Box, to which I want to use a property to
set the size of box e.g.

Box b = new Box();
b.Size = small;

To do this, I'd written in the class:

public Boxes Size
{
get{ return m_size;}
set{m_size = value;}
}

private Boxes m_size;

However, when I do this, I get the error message:

Inconsistent accessibility: property type 'MyBoxClass.MyBoxClass.Boxes' is
less accessible than property 'MyBoxClass.MyBoxClass.Box.Size'

Thanks in advance

Geoff
 
However, when I do this, I get the error message:
Inconsistent accessibility: property type 'MyBoxClass.MyBoxClass.Boxes' is
less accessible than property 'MyBoxClass.MyBoxClass.Box.Size'


You have to make the Boxes enum type public.



Mattias
 
Back
Top