У меня есть следующий класс на основе примера кода от Microsoft MSDN:System.Collections.Generic сбор и IEquatable ошибки
Imports System.Collections.Generic
Module SharedCode
Public Class Fund
Implements IEquatable(Of Fund)
'Class Fund must implement Function Equals(other As RetirementCalcOverTime.SharedCode.Fund) As Boolean for interface System.IEquatable(Of Fund)
Public Property FundName As String
Public Property StartDate As Date
Public Property StartBalance As Double
Public Property StartQuantity As Double
Public Property StartPrice As String
Public Sub New()
End Sub
Public Sub New(ByVal sFundName As String,
ByVal dStartDate As Date,
ByVal pStartBalance As Double,
ByVal pStartQuantity As Double,
ByVal pStartPrice As Double)
FundName = sFundName
StartDate = dStartDate
StartBalance = pStartBalance
StartQuantity = pStartQuantity
StartPrice = pStartPrice
End Sub
Public Function Overrides Equals(ByVal obj As Fund) As Boolean
'Overrides is flagged as invalid identifier
If obj Is Nothing Then
Return False
End If
Dim objAsFund As Fund = TryCast(obj, Fund)
If objAsFund Is Nothing Then
Return False
Else
Return Equals(objAsFund)
End If
End Function
End Class
End Module
Что я делаю неправильно, что переопределение и ошибки броска функции Равно?
VS/VB будет добавить, что вам нужно, когда вы нажимаете Enter на строке «Реализуете ...» – Plutonix
Это избавило от ошибок в реализации, благодаря чему благодаря этому Plutonix. – twellsles