public void MergeWith(XmlStyleRepository styleRepository) { LinkedList <XmlRepositoryItem> newItems = new LinkedList <XmlRepositoryItem>(); for (int i = 0; i < styleRepository.xmlRepositoryItems.Count; i++) { XmlRepositoryItem newList = styleRepository.xmlRepositoryItems[i]; bool found = false; for (int k = 0; k < this.xmlRepositoryItems.Count; k++) { XmlRepositoryItem existingList = this.xmlRepositoryItems[k]; if (existingList.Key == newList.Key) { this.xmlRepositoryItems[k] = styleRepository.xmlRepositoryItems[i]; found = true; break; } } if (!found) { newItems.AddLast(newList); } } this.xmlRepositoryItems.AddRange(newItems); }
public void MergeWith(XmlStyleRepository styleRepository) { LinkedList <XmlRepositoryItem> linkedList = new LinkedList <XmlRepositoryItem>(); for (int index1 = 0; index1 < styleRepository.xmlRepositoryItems.Count; ++index1) { XmlRepositoryItem xmlRepositoryItem = styleRepository.xmlRepositoryItems[index1]; bool flag = false; for (int index2 = 0; index2 < this.xmlRepositoryItems.Count; ++index2) { if (this.xmlRepositoryItems[index2].Key == xmlRepositoryItem.Key) { this.xmlRepositoryItems[index2] = styleRepository.xmlRepositoryItems[index1]; flag = true; break; } } if (!flag) { linkedList.AddLast(xmlRepositoryItem); } } this.xmlRepositoryItems.AddRange((IEnumerable <XmlRepositoryItem>)linkedList); }