Enums in interface error

Hi all

A while ago I posted a message about the fact that Reshaper gives errors when you try to call an enum that is embedded in an interface. Something like this:

public interface Silly
{
public enum ReallySilly
{
Value1, Value2,
}
}

When you call Silly.ReallySilly.Value1 Resharper states that it can't find the ReallySilly enum (and thus it doesn't know about Value1). The strange thing is that it compiles without problems so apparently it's legal.

I searched the tracker for the issue but I couldn't find it. Does anybody know if there is any progress on this front. It's rather annoying because the code complete doesn't work if Resharper doesn't recognize the enum.

If the issue is not in the tracker please let me know and I'll create a report.

Regards

Petrik

4 comments
Comment actions Permalink

You cannot declare types within interfaces by C# specs.

This error is correctly highlighted by the ReSharper 2.0

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Patrick" <no_mail@jetbrains.com> wrote in message
news:15539718.1119766540739.JavaMail.itn@is.intellij.net...

Hi all

>

A while ago I posted a message about the fact that Reshaper gives errors
when you try to call an enum that is embedded in an interface. Something
like this:

>

public interface Silly
{
public enum ReallySilly
{
Value1, Value2,
}
}

>

When you call Silly.ReallySilly.Value1 Resharper states that it can't find
the ReallySilly enum (and thus it doesn't know about Value1). The strange
thing is that it compiles without problems so apparently it's legal.

>

I searched the tracker for the issue but I couldn't find it. Does anybody
know if there is any progress on this front. It's rather annoying because
the code complete doesn't work if Resharper doesn't recognize the enum.

>

If the issue is not in the tracker please let me know and I'll create a
report.

>

Regards

>

Petrik



0
Comment actions Permalink

Eugene Pasynkov (JetBrains) wrote:

You cannot declare types within interfaces by C# specs.

This error is correctly highlighted by the ReSharper 2.0


Great! Where is the download link? grin. Nah, i'll wait patiently ;)

Ward

0
Comment actions Permalink

Hello Patrick,

The state of the error is "Open". It will be fixed in 2.0 version.

Thanks,
Andrey Simanovsky


0
Comment actions Permalink

Hello Eugene,

Enums can be declared in interfaces in other languages than C#. ReSharper
incorrectly highlighted usages of such enums in C# code.

You cannot declare types within interfaces by C# specs.

This error is correctly highlighted by the ReSharper 2.0

Thanks,
Andrey Simanovsky


0

Please sign in to leave a comment.