update MaterialCompareTo to compare the reference hash code instead of equaling the reference
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Imports System.Numerics
|
||||
|
||||
Public Class Material
|
||||
Implements IComparable
|
||||
Implements IComparable(Of Material)
|
||||
|
||||
Public Property Image As Image = Nothing
|
||||
Public Property Color As Color? = Nothing
|
||||
@@ -10,16 +10,11 @@ Public Class Material
|
||||
Public Property Scale As New Vector2(1.0F, 1.0F)
|
||||
Public Property Tag As Object = Nothing
|
||||
|
||||
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
|
||||
If obj IsNot Nothing Then
|
||||
If obj Is Me Then
|
||||
Return 0
|
||||
Else
|
||||
Return -1
|
||||
End If
|
||||
Else
|
||||
Return 1
|
||||
End If
|
||||
Public Function CompareTo(obj As Material) As Integer Implements IComparable(Of Material).CompareTo
|
||||
'If obj Is Me Then Return 0
|
||||
'If obj Is Nothing Then Return 1
|
||||
'Return -1
|
||||
Return GetHashCode() - If(obj?.GetHashCode, 0)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user