internal void Append(ConditionedPropertyCollection other)
        {
            foreach (var e in other.props)
            {
                var otherList = e.Value;
                var key       = e.Key;
                ImmutableList <string> list;
                if (props.TryGetValue(key, out list))
                {
                    var lb = list.ToBuilder();
                    foreach (var c in otherList)
                    {
                        if (!lb.Contains(c))
                        {
                            lb.Add(c);
                        }
                    }
                    props [key] = lb.ToImmutableList();
                }
                else
                {
                    props [key] = otherList;
                }
            }

            foreach (var e in other.combinedProps)
            {
                var otherList = e.Value;
                var key       = e.Key;
                ImmutableList <ValueSet> thisList;
                if (combinedProps.TryGetValue(key, out thisList))
                {
                    var list = thisList.ToBuilder();
                    foreach (var c in otherList)
                    {
                        if (list.IndexOf(c, 0, list.Count, StructEqualityComparer <ValueSet> .Instance) < 0)
                        {
                            // Create a new ValueSet so that the reference keys of this collection are reused
                            list.Add(new ValueSet(list [0].ReferenceKeys, c.ReferenceKeys, c.Values));
                        }
                    }
                    combinedProps [key] = list.ToImmutable();
                }
                else
                {
                    combinedProps [key] = otherList;
                }
            }
        }
Exemplo n.º 2
0
        internal void Append(ConditionedPropertyCollection other)
        {
            foreach (var e in other.props)
            {
                var otherList = e.Value;
                var key       = e.Key;
                ImmutableList <string> list;
                if (props.TryGetValue(key, out list))
                {
                    foreach (var c in otherList)
                    {
                        if (!list.Contains(c))
                        {
                            list = list.Add(c);
                        }
                    }
                    props [key] = list;
                }
                else
                {
                    props [key] = otherList;
                }
            }

            foreach (var e in other.combinedProps)
            {
                var otherList = e.Value;
                var key       = e.Key;
                ImmutableList <ValueSet> thisList;
                if (combinedProps.TryGetValue(key, out thisList))
                {
                    foreach (var c in otherList)
                    {
                        if (!thisList.Contains(c))
                        {
                            // Create a new ValueSet so that the reference keys of this collection are reused
                            thisList = thisList.Add(new ValueSet(thisList [0].ReferenceKeys, c.ReferenceKeys, c.Values));
                        }
                    }
                    combinedProps [key] = thisList;
                }
                else
                {
                    combinedProps [key] = otherList;
                }
            }
        }
		internal void Append (ConditionedPropertyCollection other)
		{
			foreach (var e in other.props) {
				var otherList = e.Value;
				var key = e.Key;
				ImmutableList<string> list;
				if (props.TryGetValue (key, out list)) {
					foreach (var c in otherList) {
						if (!list.Contains (c))
							list = list.Add (c);
					}
					props [key] = list;
				} else
					props [key] = otherList;
			}

			foreach (var e in other.combinedProps) {
				var otherList = e.Value;
				var key = e.Key;
				ImmutableList<ValueSet> thisList;
				if (combinedProps.TryGetValue (key, out thisList)) {
					foreach (var c in otherList) {
						if (!thisList.Contains (c))
							// Create a new ValueSet so that the reference keys of this collection are reused
							thisList = thisList.Add (new ValueSet (thisList [0].ReferenceKeys, c.ReferenceKeys, c.Values));
					}
					combinedProps [key] = thisList;
				} else
					combinedProps [key] = otherList;
			}
		}