Enums/Properties

J

Jim Heavey

I created a class with an Enum and a Property.

In another class I instatiate that class (with an Enum and a Property),
but I can't seem to access it?

My code looks like the following:

public enum OutputType
{
Console=0,
Text=1,
Html=2
};

public ProviderType Provider // Identify the type of provider
{
get
{
return _provider;
}
set
{
_provider = value;
}
}

The code above belongs in a class called Fred and it compiles just fine

I have another class called "Mary" and I created an instance of Fred.

At this point I am able to see all of the methods of "Fred" (via
Intellisense), but I am not able to see this properties. My instruction
looks like the following:

OutSideClass.OutputType

Why Can't I see my Enum?
 
J

Jon Skeet [C# MVP]

Jim Heavey said:
I created a class with an Enum and a Property.

In another class I instatiate that class (with an Enum and a Property),
but I can't seem to access it?

<snip>

The following code works fine for me - could you give a similarly short
but complete example which *doesn't* compile?

using System;

public class OuterClass
{
public enum OutputType
{
Console=0,
Text=1,
Html=2
}
}

public class Test
{
static void Main()
{
OuterClass.OutputType foo = OuterClass.OutputType.Text;
Console.WriteLine (foo);
}
}
 

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