2009-03-20 10 views
2

Ich brauche ein weiteres (Dutzend) Augenpaar auf diesem. Der folgende Code:Kann nicht sehen "Muss implementieren" Fehler

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 

gibt mir diese Fehlermeldung:

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

Was bin ich?

+0

Sind alle Ihre Namespaces richtig? –

Antwort

10

Sie haben nicht gesagt, GetRuleViolations implementiert iRuleEntity.GetRuleViolations. Es ist nicht implizit wie in C#.

Vom 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.

So:

Partial Public Class Feedback 
    Implements iRuleEntity 

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

End Class 

(Beachten Sie die Zeile Fortsetzung auf der ersten Zeile der Funktion.)

3
Partial Public Class Feedback 
    Implements iRuleEntity 

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

     Return Nothing 
    End Function 

End Class 
Verwandte Themen