接口可以包含ENum吗?

don*_*nde 2 .net vb.net asp.net interface

接口可以包含枚举吗?

我使用的是asp.net 2.0.突然,当我在下面的界面中添加枚举时,我的代码开始出现问题.在其中,LookUpType是一个枚举.

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
Run Code Online (Sandbox Code Playgroud)

Jar*_*Par 14

你的问题有点暧昧,听起来你可能会问以下任何一种情况

接口可以返回一个枚举类型吗?

是.枚举不会以任何方式阻止它们成为接口上的返回类型

接口是否可以包含枚举定义?

是的,这在VB.Net中是完全合法的.然而,它在C#中不合法

Interface IFoo
    Enum E1
        V1
    End Enum
    Function SomeMethod() As E1
End Interface
Run Code Online (Sandbox Code Playgroud)