예제 #1
0
        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);
        }
예제 #2
0
 public bool Equals(TypeCollection other)
 => Types.OrderBy(t => t.Key).SequenceEqual(other.Types.OrderBy(t => t.Key));