/// <summary> /// Returns the key-value pair at the specified index in the ordered map, by key order. /// </summary> /// <param name="index"></param> /// <returns></returns> /// <exception cref="ArgumentOutOfRangeException">If the index is out of range</exception> public KeyValuePair <TKey, TValue> ByOrder(int index) { index.CheckIsBetween("index", -Root.Count, Root.Count - 1); index = index < 0 ? index + Root.Count : index; var opt = Root.ByOrder(index); return(Kvp.Of(opt.Key, opt.Value)); }
/// <summary> /// Returns the element at the specified position in the sort order. /// </summary> /// <param name="index"></param> /// <returns></returns> public T ByOrder(int index) { index.CheckIsBetween("index", -Length, Length - 1); index = index < 0 ? index + Length : index; return(Root.ByOrder(index).Key); }