views:

86

answers:

1

Can an Interface contain an Enum?

I am using asp.net 2.0. Suddenly my code started having problems when I added an enum to the interface below. In it, LookUpType is an enum.

Public Interface ILookup
    Property ID() As Int32
    Property Text() As String
    Property Description() As String
    Property Status() As Status
    Property OrderID() As Int32
    ReadOnly Property LookUpType() As LookUpType
End Interface
+8  A: 

You're question is a bit ambigious, it sounds like you could be asking either of the following

Can an Interface return a type which is an enum?

Yes. Enum's are not special in any way that prevents them being a return type on an interface

Can an Interface contain an enum definition?

Yes, this is completely legal in VB.Net. It is however not legal in C#

Interface IFoo
    Enum E1
        V1
    End Enum
    Function SomeMethod() As E1
End Interface
JaredPar
When I look at this, all I see is bold questions. My eyes! :D
Jeff Yates