From af10069fc0de598678c5e1ebbbaa3d5b02c852b5 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Thu, 3 Dec 2020 08:09:32 +0100 Subject: [PATCH] update MaterialCompareTo to compare the reference hash code instead of equaling the reference --- Pilz.Simple3DFileParser/Model/Material.vb | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Pilz.Simple3DFileParser/Model/Material.vb b/Pilz.Simple3DFileParser/Model/Material.vb index 1b755b6..06ad021 100644 --- a/Pilz.Simple3DFileParser/Model/Material.vb +++ b/Pilz.Simple3DFileParser/Model/Material.vb @@ -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