Innovenergy_trunk/csharp/App/Backend/Model/TreeNode.Equality.cs

22 lines
656 B
C#
Raw Normal View History

2023-02-24 12:59:56 +00:00
using System.Diagnostics.CodeAnalysis;
2023-03-08 12:20:33 +00:00
namespace InnovEnergy.App.Backend.Model;
2023-02-24 12:59:56 +00:00
public abstract partial class TreeNode
{
// Note: Only consider Id, but not ParentId for TreeNode equality checks
2023-02-24 12:59:56 +00:00
protected Boolean Equals(TreeNode other)
{
return Id == other.Id;
2023-02-24 12:59:56 +00:00
}
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();
2023-02-24 12:59:56 +00:00
}