开发者

Can an Interface contain an ENum?

开发者 https://www.devze.com 2022-12-18 10:20 出处:网络
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.

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 Loo开发者_如何学CkUpType
End Interface


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号