/// <summary> /// Appends a node at the end of the list /// </summary> /// <param name="Key">Unique key used to look up the associated value</param> /// <param name="Value">The value to be placed in the appended node</param> /// <returns>IDataNode reference to the newly appended node</returns> public virtual IDataNode <TKey, TValue> Append(TKey Key, TValue Value) { IDataNode <TKey, TValue> Existing = this[Key]; if (Existing != null) { throw new System.ArgumentException("Duplicate keys are not allowed", nameof(Key)); } IDataNode <TKey, TValue> NewNode = CreateNode(Key, Value); if (RootNode == null) { RootNode = TerminalNode = NewNode; } else { NewNode.InsertAfter(TerminalNode); TerminalNode = NewNode; } return(NewNode); }