Return Type of function is not CLS Compliant .How can Fix this?


I have the following code and I get the above warning


In another project i have something similar but I dont get the warning and cannot see the difference

Any ideas how to remove it




Namespace TSInterfaces
    Public Interface IEmployee(Of T)
     
        Function GetEmployee(ByVal EmployeeID As Integer) As TSStructures.StructEmployee
        Function GetAllEmployees() As MyCollectionBindingList(Of T)
      
    End Interface
End Namespace


Namespace TSStructures
    <Serializable()> _
     Public Structure StructEmployee
             
        Public LastName As String
        Public FirstName As String
      


    End Structure
End Namespace

'When i go to implement the interface I get  "
'Return Type of function "Employee_Read" is not CLS Compliant"


Partial Class EmployeeDao
       Implements TSInterfaces.IEmployee(Of EmployeeDao)


    Public Function GetEmployee(ByVal EmployeeID As Integer) As TSStructures.StructEmployee Implements TSInterfaces.IEmployee(Of EmployeeDao).GetEmployee
   
    End Function

end class

 




thanks a lot for any feedback



Answer this question

Return Type of function is not CLS Compliant .How can Fix this?

  • Adrian Nicolaescu

    Hi,

    This article gives details about this compiler warning and how to fix it:
    http://msdn2.microsoft.com/en-us/library/x97t56y6.

    Did you mark EmployeeDao as CLSCompliant by any chances

    Regards,


  • Spatulaman

    Thanks for replying.By setting the compliance to false it works

    I did not mark for compliance at all.

    Its strange   I have a project with exact the same and it doenst raise the warning.

    Thanks again
    I will have a better look



  • Return Type of function is not CLS Compliant .How can Fix this?