public static string UniqueId(this IReference reference) { Contract.Requires(reference != null); if (reference is ITypeReference type) { return(type.DocId()); } if (reference is ITypeMemberReference member) { return(member.DocId()); } if (reference is IUnitNamespaceReference ns) { return(ns.DocId()); } if (reference is IAssemblyReference assembly) { return(assembly.DocId()); } // Include the hash code as well to make it unique so we can use this for a key return(LocalizedStrings.UnknownReferenceType + reference.GetHashCode().ToString(CultureInfo.InvariantCulture)); }
public static string UniqueId(this IReference reference) { Contract.Requires(reference != null); ITypeReference type = reference as ITypeReference; if (type != null) { return(type.DocId()); } ITypeMemberReference member = reference as ITypeMemberReference; if (member != null) { return(member.DocId()); } IUnitNamespaceReference ns = reference as IUnitNamespaceReference; if (ns != null) { return(ns.DocId()); } IAssemblyReference assembly = reference as IAssemblyReference; if (assembly != null) { return(assembly.DocId()); } // Include the hash code as well to make it unique so we can use this for a key return("<Unknown Reference Type>" + reference.GetHashCode().ToString()); }
public override int GetHashCode() { return(m_outerGroupLeafRef.GetHashCode() ^ m_innerGroupLeafRef.GetHashCode()); }