Newbie question: Enum in Interface

  • Thread starter Alejandro Lapeyre
  • Start date
A

Alejandro Lapeyre

In VB I can define an Enum inside an interface

Public Interface ITest
Sub a()
Enum MyEnum
kk = 1
End Enum
End Interface

When I try to do the same in C# the complier complains : "myEnum": las
interfaces no pueden declarar tipos.

public interface ITest
{
void a();
public enum myEnum
{
kk = 1
}
}

I can view the VB file with Lutz Roeder's .NET Reflector

Can this be done in C# ?
How can VB do this?

Best regards,
Alejandro Lapeyre
 
G

Guest

No - C# is very limited compared to VB (and J#) regarding what can be
included in interfaces. Basically, methods, delegates, and properties are
allowed, but not enums, classes, or structs.

David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter
 
A

Alejandro Lapeyre

Thanks David!

:)
Alejandro Lapeyre

David Anton said:
No - C# is very limited compared to VB (and J#) regarding what can be
included in interfaces. Basically, methods, delegates, and properties are
allowed, but not enums, classes, or structs.

David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter
 

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