Click here to Skip to main content
15,886,799 members
Articles / Programming Languages / C#

Doubly-Linked List Implementation

Rate me:
Please Sign up or sign in to vote.
4.66/5 (31 votes)
3 Sep 2002BSD5 min read 371.9K   3.3K   73  
An inspired implementation of a doubly-linked list in C# for the .NET Framework.
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>FoleyUtilities</name>
    </assembly>
    <members>
        <member name="T:Foley.Utilities.Collections.LinkedList">
            <summary>
            A Linked List implementation of the <see cref="T:System.Collections.IList"/> interface.
            </summary>
            <remarks>
            The <see cref="T:Foley.Utilities.Collections.LinkedList"/> can be used with all objects including null.
            <para>This class is not guaranteed to be thread safe.</para>
            The <see cref="M:System.Collections.IEnumerator.MoveNext"/> method of the <see cref="T:System.Collections.IEnumerator"/> 
            that is returned from <see cref="M:Foley.Utilities.Collections.LinkedList.GetEnumerator"/> is fail-fast.  That 
            is, if the <see cref="T:Foley.Utilities.Collections.LinkedList"/> is  modified after the enumerator is created 
            it will throw a <see cref="T:System.SystemException"/> This behavior cannot be guaranteed, 
            and should not be depended on.
            </remarks>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.#ctor">
            <summary>
            Initializes a new instance of the LinkedList class that is empty.
            </summary>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.#ctor(System.Collections.ICollection)">
            <summary>
            Initializes a new instance of the LinkedList class that contains 
            elements copied from the specified collection.
            </summary>
            <param name="collection">The ICollection whose elements are copied to the new list.</param>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Add(System.Object)">
            <summary>
            Adds an <see cref="T:System.Object"/> to the end of the 
            <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="value">
            The <see cref="T:System.Object"/> to be added to the end of 
            the <see cref="T:Foley.Utilities.Collections.LinkedList"/>
            </param>
            <returns>
            The <see cref="T:Foley.Utilities.Collections.LinkedList"/> index at which the 
            <paramref name="value"/> was added.
            </returns>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.AddAll(System.Collections.ICollection)">
            <summary>
            Adds the <see cref="T:System.Object"/>s of an <see cref="T:System.Collections.ICollection"/> 
            to the end of the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="collection">
            The <see cref="T:System.Collections.ICollection"/> whose <see cref="T:System.Object"/>s 
            should be added to the end of the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="collection"/> is a <c>null</c> reference 
            (<c>Nothing</c> in Visual Basic).
            </exception>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Clear">
            <summary>
            Removes all <see cref="T:System.Object"/>s from the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Clone">
            <summary>
            Creates a shallow copy of the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <returns>
            A shallow copy of the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </returns>
            <remarks>
            If you need a deep copy to be attempted use the
            <see cref="M:Foley.Utilities.Collections.LinkedList.Clone(System.Boolean)"/> method.
            </remarks>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Clone(System.Boolean)">
            <summary>
            Attempts to make a deep copy of the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="attemptDeepCopy">
            If true will attempt to make a deep copy, 
            if false it will just return a shallow copy
            </param>
            <returns>
            The newly cloned <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </returns>
            <exception cref="T:System.SystemException">
            If and <see cref="T:System.Object"/> in the list is not an 
            <see cref="T:System.ICloneable"/>.
            </exception>
            <remarks>
            Attempts to make a deep copy if <paramref name="attemptDeepCopy"/> is true.
            It will attempt this by checking if an <see cref="T:System.Object"/> is an 
            <see cref="T:System.ICloneable"/>, and then defer the process to its Clone method. 
            At the first <see cref="T:System.Object"/> that is not an <see cref="T:System.ICloneable"/>
            a SystemException will be thrown.
            <para>
            If a true deep copy is important, please check the <see cref="T:System.Object"/>s that are
            contained in the list API documentation to verify how its Clone method
            was implemented.
            </para>
            </remarks>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Contains(System.Object)">
            <summary>
            Determines whether an <see cref="T:System.Object"/> is in the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="value">
            <br>The <see cref="T:System.Object"/> to locate in the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.</br> 
            The <see cref="T:System.Object"/> to locate can be a <c>null</c> reference (<c>Nothing</c> in Visual Basic). 
            </param>
            <returns>
            <c>true</c> if <paramref name="value"/> is found in the <see cref="T:Foley.Utilities.Collections.LinkedList"/>; otherwise, false.
            </returns>
            <remarks>
            This method determines equality by calling <see cref="M:System.Object.Equals(System.Object)"/>.
            </remarks>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.CopyTo(System.Array,System.Int32)">
            <summary>
            Copies the entire <see cref="T:Foley.Utilities.Collections.LinkedList"/> to a compatible one-dimensional <see cref="T:System.Array"/>, 
            starting at the specified <paramref name="index"/> of the target <paramref name="array"/>.
            </summary>
            <param name="array">
            <br>The one-dimensional <see cref="T:System.Array"/> that is the destination of the <see cref="T:System.Object"/>s</br>
            copied from the <see cref="T:Foley.Utilities.Collections.LinkedList"/>. The <see cref="T:System.Array"/> must have zero-based indexing.
            </param>
            <param name="index">
            The zero-based <paramref name="index"/> in <paramref name="array"/> at which copying begins.
            </param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="array"/> is a <c>null</c> reference (<c>Nothing</c> in Visual Basic).
            </exception>
            <exception cref="T:System.ArgumentOutOfRangeException">
            The <paramref name="index"/> is less than zero.
            </exception>
            <exception cref="T:System.ArgumentException">
            The <paramref name="array"/> is multidimensional.
            <p>-or-</p>
            The <paramref name="index"/> is equal to or greater than the length of <paramref name="array"/>.
            <p>-or-</p>
            <br>The number of <see cref="T:System.Object"/>s in the <see cref="T:Foley.Utilities.Collections.LinkedList"/> is greater than</br>
            the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>.
            </exception>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.GetEnumerator">
            <summary>
            Returns an enumerator for the entire <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <returns>
            An <see cref="T:System.Collections.IEnumerator"/> for the entire <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </returns>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.IndexOf(System.Object)">
            <summary>
            Searches for the specified <see cref="T:System.Object"/> and returns the zero-based 
            index of the first occurrence within the entire <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="value">
            The <see cref="T:System.Object"/> to locate in the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </param>
            <returns>
            The zero-based index of the first occurrence of <paramref name="value"/> within the entire 
            <see cref="T:Foley.Utilities.Collections.LinkedList"/>, if found; otherwise, -1.
            </returns>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Insert(System.Int32,System.Object)">
            <summary>
            Inserts an <see cref="T:System.Object"/> into the <see cref="T:Foley.Utilities.Collections.LinkedList"/> 
            at the specified <paramref name="index"/>.
            </summary>
            <param name="index">
            The zero-based <paramref name="index"/> at which 
            <paramref name="value"/> should be inserted.
            </param>
            <param name="value">
            The <see cref="T:System.Object"/> to insert.
            </param>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.InsertAll(System.Int32,System.Collections.ICollection)">
            <summary>
            Inserts all the <see cref="T:System.Object"/>s of an <see cref="T:System.Collections.ICollection"/> starting at a
            index in the <see cref="T:Foley.Utilities.Collections.LinkedList"/>. 
            </summary>
            <param name="index">
            The index in the <see cref="T:Foley.Utilities.Collections.LinkedList"/> to starting inserting the
            objects of the provided <see cref="T:System.Collections.ICollection"/>.
            </param>
            <param name="collection">
            The <see cref="T:System.Collections.ICollection"/> whose objects should be inserted 
            to the <see cref="T:Foley.Utilities.Collections.LinkedList"/> starting at the provided index.
            </param>
            <exception cref="T:System.ArgumentNullException">
            The collection is a null reference (Nothing in Visual Basic).
            </exception>
            <exception cref="T:System.ArgumentOutOfRangeException">
            The index is less than zero.
            </exception>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Remove(System.Object)">
            <summary>
            Removes the first occurrence of a specific <see cref="T:System.Object"/> 
            from the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="value">
            The <see cref="T:System.Object"/> to remove from the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </param>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.RemoveAt(System.Int32)">
            <summary>
            Removes the <see cref="T:System.Object"/> at the specified 
            <paramref name="index"/> of the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="index">
            The zero-based <paramref name="index"/> of the 
            <see cref="T:System.Object"/> to remove.
            </param>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.FindNodeAt(System.Int32)">
            <summary>
            Returns the <see cref="T:Foley.Utilities.Collections.LinkedList.Node"/> at the provided <paramref name="index"/>.
            </summary>
            <param name="index">
            The zero-based <paramref name="index"/> of the <see cref="T:Foley.Utilities.Collections.LinkedList.Node"/>.
            </param>
            <returns>
            The <see cref="T:Foley.Utilities.Collections.LinkedList.Node"/> at the provided <paramref name="index"/>.
            </returns>
            <exception cref="T:System.IndexOutOfRangeException">
            If the <paramref name="index"/> is invalid.
            </exception>
        </member>
        <member name="M:Foley.Utilities.Collections.LinkedList.Remove(Foley.Utilities.Collections.LinkedList.Node)">
            <summary>
            Removes the <see cref="T:Foley.Utilities.Collections.LinkedList.Node"/> from the <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
            <param name="value">
            </param>
            <remarks>
            This removal adjusts the remaining <see cref="T:Foley.Utilities.Collections.LinkedList.Node"/> accordingly.
            </remarks>
        </member>
        <member name="P:Foley.Utilities.Collections.LinkedList.Count">
            <summary>
            Gets the number of objects contained in the LinkedList.
            </summary>
        </member>
        <member name="P:Foley.Utilities.Collections.LinkedList.IsSynchronized">
            <summary>
            Returns false.
            </summary>
        </member>
        <member name="P:Foley.Utilities.Collections.LinkedList.SyncRoot">
            <summary>
            Returns a reference to this <see cref="T:Foley.Utilities.Collections.LinkedList"/>.
            </summary>
        </member>
        <member name="P:Foley.Utilities.Collections.LinkedList.IsFixedSize">
            <summary>
            Returns false.
            </summary>
        </member>
        <member name="P:Foley.Utilities.Collections.LinkedList.IsReadOnly">
            <summary>
            Returns false.
            </summary>
        </member>
        <member name="P:Foley.Utilities.Collections.LinkedList.Item(System.Int32)">
            <summary>
            Gets or sets the <see cref="T:System.Object"/> at the specified 
            <paramref name="index"/>. [C#] In C#, this property is 
            the indexer for the <see cref="T:Foley.Utilities.Collections.LinkedList"/> class.
            </summary>
        </member>
    </members>
</doc>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions