我需要另外一双(十几只)眼睛.以下代码:
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
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
'Feedback' must implement 'Function GetRuleViolations() As System.Collections.Generic.List(Of RuleViolation)' for interface 'iRuleEntity'.
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
Jon*_*eet 10
你没有说过那个GetRuleViolations
工具iRuleEntity.GetRuleViolations
.它并不像C#中那样隐含.
来自以下文档Implements
:
您可以使用Implements语句指定类或结构实现一个或多个接口,然后为每个成员使用Implements关键字指定哪个接口及其实现的成员.
所以:
Partial Public Class Feedback
Implements iRuleEntity
Public Function GetRuleViolations() As List(Of RuleViolation) _
Implements iRuleEntity.GetRuleViolations
Return Nothing
End Function
End Class
Run Code Online (Sandbox Code Playgroud)
(注意函数第一行的续行.)