Q: enum

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
 
M

Mattias Sjögren

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top