public static string RefDocId(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()); } Contract.Assert(false, string.Format(CultureInfo.CurrentUICulture, LocalizedStrings.FellThroughCasesIn, "DocIdExtensions.RefDocId()", reference.GetType())); return(LocalizedStrings.UnknownReferenceType); }
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 static string RefDocId(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()); } Contract.Assert(false, string.Format("Fell through cases in TypeExtensions.RefDocId() Type of reference: {0}", reference.GetType())); return("<Unknown Reference Type>"); }