私の質問は私の一般的な理解のためのものです。それは問題ではありません。以下は私のプロジェクトのデモクラスです。
Public Class Registration
Inherits HumanBase
Private _NameeValue As HumanName
Property Namee As HumanName
Get
Return _NameeValue
End Get
Set(ByVal Value As HumanName)
If Not _NameeValue = Value Then
_NameeValue = Value
OnPropertyChanged("Namee")
End If
End Set
End Property
Private _UserPasswordValue As String
Public Property UserPassword() As String
Get
Return _UserPasswordValue
End Get
Set(ByVal value As String)
If Not _UserPasswordValue.Equals(value) Then
_UserPasswordValue = value
OnPropertyChanged("UserPassword")
End If
End Set
End Property
Private _UserEmailValue As String
Public Property UserEmail() As String
Get
Return _UserEmailValue
End Get
Set(ByVal value As String)
If Not _UserEmailValue = value Then
_UserEmailValue = value
OnPropertyChanged("UserEmail")
End If
End Set
End Property
Property UserPassword2 As String
End Class
Public Class HumanName
Inherits HumanBase
Implements IComparable(Of HumanName)
Implements IEqualityComparer(Of HumanName)
#Region "Private Variables"
Private _TitleNameValue As CommonTypes.TitleName
Private _FirstNameValue As String
Private _MiddleNameValue As String
Private _LastNameValue As String
Private _SuffixNameValue As CommonTypes.Suffixname
#End Region
#Region "Property Variables"
Property TitleName As CommonTypes.TitleName
Get
Return _TitleNameValue
End Get
Set(ByVal Value As CommonTypes.TitleName)
If Not _TitleNameValue = Value Then
_TitleNameValue = Value
OnPropertyChanged("TitleName")
End If
End Set
End Property
Property FirstName As String
Get
Return _FirstNameValue
End Get
Set(ByVal Value As String)
If Not _FirstNameValue = Value Then
_FirstNameValue = Value
OnPropertyChanged("FirstName")
End If
End Set
End Property
Property MiddleName As String
Get
Return _MiddleNameValue
End Get
Set(ByVal Value As String)
If Not _MiddleNameValue = Value Then
_MiddleNameValue = Value
OnPropertyChanged("MiddleName")
End If
End Set
End Property
Property LastName As String
Get
Return _LastNameValue
End Get
Set(ByVal Value As String)
If Not _LastNameValue = Value Then
_LastNameValue = Value
OnPropertyChanged("LastName")
End If
End Set
End Property
Property SuffixName As CommonTypes.Suffixname
Get
Return _SuffixNameValue
End Get
Set(ByVal Value As CommonTypes.Suffixname)
If Not _SuffixNameValue = Value Then
_SuffixNameValue = Value
OnPropertyChanged("SuffixName")
End If
End Set
End Property
#End Region
Public Function CompareTo(ByVal other As HumanName) As Integer Implements System.IComparable(Of HumanName).CompareTo
Return True
End Function
Public Function Equals1(ByVal x As HumanName, ByVal y As HumanName) As Boolean Implements System.Collections.Generic.IEqualityComparer(Of HumanName).Equals
Return True
End Function
Public Function GetHashCode1(ByVal obj As HumanName) As Integer Implements System.Collections.Generic.IEqualityComparer(Of HumanName).GetHashCode
Return True
End Function
End Class
コード自体のコーディング時に " If Not _NameeValue = Value Then
" でエラーが発生し、エラーはError Operator '=' is not defined for types 'SharesCommCodeLib.Human.HumanName' and 'SharesCommCodeLib.Human.HumanName'
です。
ICOMPAREABLE と IEquitableComparer の両方を実装したときに '=" が機能しない理由を教えてください. DotNet はそれを演算子のオーバーロードと見なしませんか.
ありがとうございました。