How to make enum class member visible?

G

Guest

Hi, friends,

I have an enum type class member like the follows, which will be shared by
all other classes,

public class FileFlags
{
.......
public static enum FileItem
{
Name = 0,
ItemType,
VersionNumber,
DateTime,
}
}

However, I could not see it from other class, i.e., after the declaration,

FileFlags myFileFlags = new FileFlags();

in myFileFlags online drop-down property/method window, I could not find
FileItem.

It could be easy, but please help....

Thanks.
 
R

Rafael Pereyra

It's only a bug in Visual Studio, it should work after compiling your
class...

Rafael.
 
J

Jon Skeet [C# MVP]

Andrew said:
I have an enum type class member like the follows, which will be shared by
all other classes,

public class FileFlags
{
.......
public static enum FileItem
{
Name = 0,
ItemType,
VersionNumber,
DateTime,
}
}

Please post some actual code which will compile. Enums can't be
declared static, and if that bit is different from your actual code,
other things could be too.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
R

Rafael Pereyra

Sorry, my mistake...
I didn't read the static word.

You can declare the enum outside the class as public, this maybe is a very
simple solution.

Good Luck.
 

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