kogepanmanの日記: [VB.NET] Dictionary(Of TKey, TValue)でちょっとはまった
日記 by
kogepanman
TKeyに自作のクラスを使用する場合は、そのクラスでIEquatableを実装しないとContainsKey()がおかしくなる。
Public Class Elm
Implements IEquatable(Of Elm)
Public xid As String
Public eid As String
Public Function Equals1(ByVal other As Elm) As Boolean Implements System.IEquatable(Of Elm).Equals
Return xid = other.xid And eid = other.eid
End Function
End Class
Public Class Elm
Implements IEquatable(Of Elm)
Public xid As String
Public eid As String
Public Function Equals1(ByVal other As Elm) As Boolean Implements System.IEquatable(Of Elm).Equals
Return xid = other.xid And eid = other.eid
End Function
End Class