using System.Diagnostics.CodeAnalysis; 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; } public override Boolean Equals(Object? obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return obj.GetType() == GetType() && Equals((TreeNode)obj); } [SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")] public override Int32 GetHashCode() => Id.GetHashCode(); }