2009-03-20 22 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

GetRuleViolationsiRuleEntity.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 
関連する問題