Пример #1
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>
        /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance is less than obj. Zero This instance is equal to obj. Greater than zero This instance is greater than obj.
        /// </returns>
        /// <exception cref="T:System.ArgumentException">obj is not the same type as this instance. </exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            if (obj.GetType() == this.GetType())
            {
                VisitableLinkedList <T> l = obj as VisitableLinkedList <T>;

                return(this.Count.CompareTo(l.Count));
            }
            else
            {
                return(this.GetType().FullName.CompareTo(obj.GetType().FullName));
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Deque&lt;T&gt;"/> class.
 /// </summary>
 /// <param name="collection">A collection implementing the IEnumerable&lt;T&gt; interface.</param>
 public Deque(System.Collections.Generic.IEnumerable <T> collection)
 {
     list = new VisitableLinkedList <T>(collection);
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Deque&lt;T&gt;"/> class.
 /// </summary>
 public Deque()
 {
     list = new VisitableLinkedList <T>();
 }