public TypeCollection MergeInDocumentation(TypeCollection documentationCollection) { TypeCollection result = this; HashSet <NameInfo> appliedTypes = new HashSet <NameInfo>(); foreach (TypeDoc type in this) { NameInfo name = type.Name; NameInfo genericizedName = name.GenericizeTypeParameters(); if (documentationCollection.Types.TryGetValue(genericizedName, out TypeDoc typeDoc)) { TypeDoc newType = type.MergeInDocumentation(typeDoc); result = new TypeCollection(result.Types.Remove(genericizedName).SetItem(name, newType)); appliedTypes.Add(genericizedName); } } foreach (TypeDoc type in documentationCollection) { if (appliedTypes.Contains(type.Name)) { continue; } result = new TypeCollection(result.Types.Add(type.Name, type)); } return(result); }
public bool Equals(TypeCollection other) => Types.OrderBy(t => t.Key).SequenceEqual(other.Types.OrderBy(t => t.Key));