Skip to content

Commit 1afaca7

Browse files
author
Marco De Salvo
committed
Better support for equality on RDFNamespace
1 parent e825f3b commit 1afaca7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

RDFSharp/Model/RDFNamespace.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ public override string ToString()
9999
/// </summary>
100100
public bool Equals(RDFNamespace other)
101101
=> other != null && NamespaceID.Equals(other.NamespaceID);
102+
103+
/// <summary>
104+
/// Performs the equality comparison between two namespaces
105+
/// </summary>
106+
public override bool Equals(object other)
107+
=> other is RDFNamespace ns && NamespaceID == ns.NamespaceID;
108+
109+
/// <summary>
110+
/// Calculates the hashcode of this namespace
111+
/// </summary>
112+
public override int GetHashCode()
113+
=> NamespaceID.GetHashCode();
102114
#endregion
103115

104116
#region Methods

0 commit comments

Comments
 (0)