2009-03-20 2 views
2

Мне нужна еще одна (дюжина) пара глаз. Следующий код:Не удается увидеть ошибку «Должен реализовать»

Interface iRuleEntity 
    Function GetRuleViolations() As List(Of RuleViolation) 
End Interface 

Partial Public Class Feedback 
    Implements iRuleEntity 

    Public Function GetRuleViolations() As List(Of RuleViolation) 
     Return Nothing 
    End Function 

End Class 

дает мне эту ошибку:

'Feedback' must implement 'Function GetRuleViolations() As System.Collections.Generic.List(Of RuleViolation)' for interface 'iRuleEntity'. 

Что я упускаю?

+0

ли все ваши Пространства имен не так ли? –

ответ

10

Вы не сказали, что GetRuleViolations реализует iRuleEntity.GetRuleViolations. Это не подразумевается, как в C#.

От docs for Implements:

You use the Implements statement to specify that a class or structure implements one or more interfaces, and then for each member you use the Implements keyword to specify which interface and which member it implements.

Итак:

Partial Public Class Feedback 
    Implements iRuleEntity 

    Public Function GetRuleViolations() As List(Of RuleViolation) _ 
    Implements iRuleEntity.GetRuleViolations 
     Return Nothing 
    End Function 

End Class 

(Обратите внимание на продолжение линии на первой строке функции.)

3
Partial Public Class Feedback 
    Implements iRuleEntity 

    Public Function GetRuleViolations() As List(Of RuleViolation) 
     Implements iRuleEntity.GetRuleViolations 

     Return Nothing 
    End Function 

End Class 
Смежные вопросы