public override int GetHashCode() { int hashCode = 387039986; hashCode = hashCode * -1521134295 + NamespaceIndex.GetHashCode(); hashCode = hashCode * -1521134295 + IdType.GetHashCode(); switch (IdType) { case IdType.Numeric: hashCode = hashCode * -1521134295 + EqualityComparer <uint> .Default.GetHashCode((uint)Identifier); break; case IdType.String: hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode((string)Identifier); break; case IdType.Guid: hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode((Guid)Identifier); break; case IdType.Opaque: hashCode = hashCode * -1521134295 + ByteSequenceComparer.GetHashCode((byte[])Identifier); break; } return(hashCode); }
public bool Equals(NodeId?other) { if (other != null && NamespaceIndex == other.NamespaceIndex && IdType == other.IdType) { switch (IdType) { case IdType.Numeric: return(EqualityComparer <uint> .Default.Equals((uint)Identifier, (uint)other.Identifier)); case IdType.String: return(EqualityComparer <string> .Default.Equals((string)Identifier, (string)other.Identifier)); case IdType.Guid: return(EqualityComparer <Guid> .Default.Equals((Guid)Identifier, (Guid)other.Identifier)); case IdType.Opaque: return(ByteSequenceComparer.Equals((byte[])Identifier, (byte[])other.Identifier)); } } return(false); }