/// <summary> /// This method is for finding the root of the heap, without removing it. /// </summary> /// <param name="keyValue">The key-value of the root.</param> /// <param name="heapArrayLength">The length of the heap array. </param> /// <returns>True in case of success, and false in case of failure.</returns> public override bool TryFindRoot(out KeyValuePair <TKey, TValue> keyValue, int heapArrayLength) { if (HeapArray.Any()) { keyValue = HeapArray[0]; return(true); } keyValue = new KeyValuePair <TKey, TValue>((TKey)typeof(TKey).GetField("MaxValue").GetValue(null), default(TValue)); return(false); }