public void GetElementPriority(int i, out T element, out int priority)
        {
            ElementPriorityPair <T> elementPriorityPair = this.list[i];

            element  = elementPriorityPair.Element;
            priority = elementPriorityPair.Priority;
        }
        public virtual int Add(T element, int priority)
        {
            if (element == null)
            {
                return(-1);
            }
            int i     = 0;
            int count = this.list.Count;

            while (i < count)
            {
                ElementPriorityPair <T> elementPriorityPair = this.list[i];
                if (elementPriorityPair.Element == element)
                {
                    return(-1);
                }
                if (priority > elementPriorityPair.Priority)
                {
                    this.list.Insert(i, new ElementPriorityPair <T>(element, priority));
                    return(i);
                }
                i++;
            }
            this.list.Add(new ElementPriorityPair <T>(element, priority));
            return(this.list.Count - 1);
        }