Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enums/Properties

0 views
Skip to first unread message

Jim Heavey

unread,
Dec 24, 2003, 9:54:09 PM12/24/03
to
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?

William Ryan

unread,
Dec 24, 2003, 10:22:50 PM12/24/03
to
Same Namespace?
"Jim Heavey" <JimH...@nospam.com> wrote in message
news:Xns945BD4A6DEA3CJ...@207.46.248.16...

Jon Skeet [C# MVP]

unread,
Dec 25, 2003, 2:34:30 AM12/25/03
to
Jim Heavey <JimH...@nospam.com> wrote:
> 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);
}
}

--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

0 new messages