/// <summary> /// Merges current list with the list of lists specified in the parameter. /// </summary> /// <param name="lists">Lists to merge with.</param> /// <returns>Merged list.</returns> public PFKeyValueListEx <TKey, TValue> Merge(PFListEx <PFKeyValueListEx <TKey, TValue> > lists) { PFKeyValueListEx <TKey, TValue> mergedList = new PFKeyValueListEx <TKey, TValue>(); if (lists == null) { return(mergedList); } foreach (pfKeyValuePair <TKey, TValue> item in this) { mergedList.Add(item); } for (int listInx = 0; listInx < lists.Count; listInx++) { PFKeyValueListEx <TKey, TValue> tempList = lists[listInx]; if (tempList != null) { foreach (pfKeyValuePair <TKey, TValue> item in tempList) { mergedList.Add(item); } } } return(mergedList); }
/// <summary> /// Merges current list with the list specified in the parameter. /// </summary> /// <param name="list">List to merge with.</param> /// <returns>Merged list.</returns> public PFKeyValueListEx <TKey, TValue> Merge(PFKeyValueListEx <TKey, TValue> list) { PFKeyValueListEx <TKey, TValue> mergedList = new PFKeyValueListEx <TKey, TValue>(); if (list == null) { return(mergedList); } foreach (pfKeyValuePair <TKey, TValue> item in this) { mergedList.Add(item); } foreach (pfKeyValuePair <TKey, TValue> item in list) { mergedList.Add(item); } return(mergedList); }
/// <summary> /// Converts PFKeyValueListExSorted object to PFKeyValueListEx object. /// </summary> /// <returns>PFKeyValueListEx object.</returns> public PFKeyValueListEx <K, V> ConvertThisToPFKeyValueListEx() { PFKeyValueListEx <K, V> kvlist = new PFKeyValueListEx <K, V>(); IEnumerator <KeyValuePair <K, V> > enumerator = GetEnumerator(); while (enumerator.MoveNext()) { // Get current key value pair pfKeyValuePair <K, V> keyValuePair = new pfKeyValuePair <K, V>(enumerator.Current.Key, enumerator.Current.Value); kvlist.Add(keyValuePair); } return(kvlist); }
/// <summary> /// Converts currentg instance to another PFKeyValueListEx object. /// </summary> /// <returns>PFKeyValueListEx object.</returns> public PFKeyValueListEx <TKey, TValue> CopyThisToPFKeyValueListEx() { PFKeyValueListEx <TKey, TValue> kvlist = new PFKeyValueListEx <TKey, TValue>(); pfKeyValuePair <TKey, TValue> kvp = default(pfKeyValuePair <TKey, TValue>); if (this.Count > 0) { this.SetToBOF(); kvp = this.FirstItem; while (this.EOF == false) { kvlist.Add(new pfKeyValuePair <TKey, TValue>(kvp.Key, kvp.Value)); kvp = this.NextItem; } } return(kvlist); }
/// <summary> /// Routine that concatenates two or more lists into one list. /// </summary> /// <param name="lists">List of list objects to be concatenated.</param> /// <returns>Concatenated list.</returns> public static PFKeyValueListEx <TKey, TValue> ConcatenateLists(PFListEx <PFKeyValueListEx <TKey, TValue> > lists) { PFKeyValueListEx <TKey, TValue> concatenatedList = new PFKeyValueListEx <TKey, TValue>(); if (lists == null) { return(concatenatedList); } for (int listInx = 0; listInx < lists.Count; listInx++) { PFKeyValueListEx <TKey, TValue> tempList = lists[listInx]; if (tempList != null) { foreach (pfKeyValuePair <TKey, TValue> item in tempList) { concatenatedList.Add(item); } } } return(concatenatedList); }