문제

I have the following property defined. MyLibrary.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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top