An unbounded priority IQueue based on a priority heap. This queue orders elements according to an order specified at construction time, which is specified either according to their natural order (see IComparable, or according to a IComparer, depending on which constructor is used. A priority queue does not permit elements. A priority queue relying on natural ordering also does not permit insertion of non-comparable objects (doing so will result InvalidCastException. The head of this queue is the lowest element with respect to the specified ordering. If multiple elements are tied for lowest value, the head is one of those elements -- ties are broken arbitrarily. A priority queue is unbounded, but has an internal capacity governing the size of an array used to store the elements on the queue. It is always at least as large as the queue size. As elements are added to a priority queue, its capacity grows automatically. The details of the growth policy are not specified. This class and its enumerator implement all of the optional methods of the ICollection and IEnumerator interfaces. The enumerator provided in method GetEnumerator is not guaranteed to traverse the elements of the PriorityQueue in any particular order. Note that this implementation is NOT synchronized. Multiple threads should not access a PriorityQueue instance concurrently if any of the threads modifies the list structurally. Instead, use the thread-safe PriorityBlockingQueue.