Beispiel #1
0
 private IntrusiveCollection.Element RemoveElement(IntrusiveCollection.Element elem
                                                   )
 {
     IntrusiveCollection.Element prev = elem.GetPrev(this);
     IntrusiveCollection.Element next = elem.GetNext(this);
     elem.RemoveInternal(this);
     prev.SetNext(this, next);
     next.SetPrev(this, prev);
     size--;
     return(next);
 }
Beispiel #2
0
 /// <summary>Add an element to the end of the list.</summary>
 /// <param name="elem">The new element to add.</param>
 public virtual bool AddItem(E elem)
 {
     if (elem == null)
     {
         return(false);
     }
     if (elem.IsInList(this))
     {
         return(false);
     }
     IntrusiveCollection.Element prev = root.GetPrev(this);
     prev.SetNext(this, elem);
     root.SetPrev(this, elem);
     elem.InsertInternal(this, prev, root);
     size++;
     return(true);
 }