开发者

CLS-Compliant issue

开发者 https://www.devze.com 2023-01-02 05:24 出处:网络
I have the following property defined.M开发者_开发技巧yLibrary.PumpSignal is an enum as follows:

I have the following property defined. M开发者_开发技巧yLibrary.PumpSignal is an enum as follows:

Public Enum PumpSignal As Integer
    PumpOff = 0
    PumpOn = 1
End Enum

Then I have another class with a property of the PumpSignal type.

Property PumpState() As MyLibrary.PumpSignal
        Get
            Return m_PumpState
        End Get
        Set(ByVal value As MyLibrary.PumpSignal)
            m_PumpState = value
        End Set
End Property

.NET keeps complaining that the Return value from PumpState is no cls-compliant.


A type is only CLS-compliant if it or its assembly is explicitly marked as CLS-compliant.

Add <Assembly: CLSCompliant(True)> to the library.

Alternatively, add <CLSCompliant(False)> to the property.

0

精彩评论

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