tags:

views:

83

answers:

2

I need another (dozen) pair of eyes on this. The following code:

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

is giving me this error:

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

What am I missing?

+4  A: 

You haven't said that GetRuleViolations implements iRuleEntity.GetRuleViolations. It's not implicit like it is in C#.

From the 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

(Note the line continuation on the first line of the function.)

Jon Skeet
+2  A: 
Partial Public Class Feedback
    Implements iRuleEntity

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

        Return Nothing
    End Function

End Class
RossFabricant