From e6fa2933b54b09aab3cfff9b76b8710ccf79d750 Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 8 Mar 2023 13:28:22 +0100 Subject: [PATCH] Only consider Id, but not ParentId for TreeNode equality checks --- csharp/App/Backend/Model/TreeNode.Equality.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/csharp/App/Backend/Model/TreeNode.Equality.cs b/csharp/App/Backend/Model/TreeNode.Equality.cs index e2e374ef4..f37cd51d7 100644 --- a/csharp/App/Backend/Model/TreeNode.Equality.cs +++ b/csharp/App/Backend/Model/TreeNode.Equality.cs @@ -4,9 +4,10 @@ namespace InnovEnergy.App.Backend.Model; public abstract partial class TreeNode { + // Note: Only consider Id, but not ParentId for TreeNode equality checks protected Boolean Equals(TreeNode other) { - return Id == other.Id && ParentId == other.ParentId; + return Id == other.Id; } public override Boolean Equals(Object? obj) @@ -17,8 +18,5 @@ public abstract partial class TreeNode } [SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")] - public override Int32 GetHashCode() - { - return HashCode.Combine(Id, ParentId); - } + public override Int32 GetHashCode() => Id.GetHashCode(); } \ No newline at end of file