【发布时间】:2015-10-13 11:02:29
【问题描述】:
我在 c# 类库中有以下代码...
public static class foo
{
public enum bar
{
bsNone = -1,
bsSolid = 0,
bsDash = 1
}
}
在 VB.Net Winforms 应用程序中,我将枚举引用为属性的返回类型:
Private _LeftBorderStyle As foo.bar
Public Property LeftBorderStyle() As foo.bar
Get
Return _LeftBorderStyle
End Get
Set(ByVal value As foo.bar)
_LeftBorderStyle = value
End Set
End Property
当我构建 VB.Net 项目时,我收到以下警告:
Return type of function 'LeftBorderStyle' is not CLS-compliant.
你能告诉我为什么枚举不符合 CLS 吗?
【问题讨论】:
-
类库是否标记为符合 CLS?否则,您将收到该警告。
-
没有。但我不明白为什么课堂上的其他 4,000 行代码没有给我 CLS 合规性警告?只有枚举?
-
@Backs - 谢谢,那篇文章没有解释为什么枚举不符合 CLS。
-
能否请您告诉我您用于为属性分配值/访问值的代码
标签: c# vb.net enums cls-compliant