How to get global access to enum types in C#?

Posted by lala on Stack Overflow See other posts from Stack Overflow or by lala
Published on 2010-05-16T18:18:14Z Indexed on 2010/05/16 18:20 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

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, west };

Then have that enum type accessible to all classes so that some other class could for instance have:

Direction dir = north;

and be able to pass the enum type between classes:

public void changeDirection(Direction direction) {
   dir = direction;
}

I thought that setting the enum to public would make this automatically possible, but it doesn't seem to be visible outside of the class I declared the enum in.

© Stack Overflow or respective owner

Related posts about beginner

Related posts about c#