Newbie question: Enum in Interface

  • Thread starter Thread starter Alejandro Lapeyre
  • Start date 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
 
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
 
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
 
Back
Top