Ejemplo n.º 1
0
 public virtual bool Contains(object o)
 {
     try
     {
         IntrusiveCollection.Element element = (IntrusiveCollection.Element)o;
         return(element.IsInList(this));
     }
     catch (InvalidCastException)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
 public virtual bool Remove(object o)
 {
     try
     {
         IntrusiveCollection.Element elem = (IntrusiveCollection.Element)o;
         if (!elem.IsInList(this))
         {
             return(false);
         }
         RemoveElement(elem);
         return(true);
     }
     catch (InvalidCastException)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 /// <summary>Add an element to the front of the list.</summary>
 /// <param name="elem">The new element to add.</param>
 public virtual bool AddFirst(IntrusiveCollection.Element elem)
 {
     if (elem == null)
     {
         return(false);
     }
     if (elem.IsInList(this))
     {
         return(false);
     }
     IntrusiveCollection.Element next = root.GetNext(this);
     next.SetPrev(this, elem);
     root.SetNext(this, elem);
     elem.InsertInternal(this, root, next);
     size++;
     return(true);
 }