Ejemplo n.º 1
0
        /// <summary>
        /// method to remove the node in the list
        /// </summary>
        /// <param name="resident"></param>
        public void Remove(ResidentNode resident)
        {
            ResidentNode temp = Head;
            ResidentNode prev = null;

            if (temp != null && temp.Get() == resident.Get())
            {
                Head = temp.next;
                return;
            }

            while (temp != null && temp.Get() != resident.Get())
            {
                prev = temp;
                temp = temp.next;
            }

            if (temp == null)
            {
                return;
            }

            prev.next = temp.next;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// method to get temp resident
 /// </summary>
 /// <returns></returns>
 public Resident Get()
 {
     return(Temp.Get());
 }