DoubleLinkListEnumerator.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Util / DoubleLinkListEnumerator.cs / 1 / DoubleLinkListEnumerator.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

/* 
 * DoubleLinkList 
 *
 * Copyright (c) 1998-1999, Microsoft Corporation 
 *
 */

namespace System.Web.Util { 
    using System.Runtime.Serialization.Formatters;
    using System.Collections; 
 
    internal class DoubleLinkListEnumerator : IEnumerator {
        private DoubleLinkList  _list; 
        private DoubleLink      _current;

        internal DoubleLinkListEnumerator(DoubleLinkList list) {
            _list = list; 
            _current = list;
        } 
 
        public void Reset() {
            _current = _list; 
        }

        public bool MoveNext() {
            if (_current.Next == _list) { 
                _current = null;
                return false; 
            } 

            _current = _current.Next; 
            return true;
        }

        public Object Current { 
            get {
                if (_current == null || _current == _list) 
                    throw new InvalidOperationException(); 
                return _current.Item;
            } 
        }

        internal DoubleLink GetDoubleLink() {
            return _current; 
        }
 
#if UNUSED_CODE 
        internal void Remove() {
            if (_current == null || _current == _list) 
                throw new InvalidOperationException();

            DoubleLink  t = _current;
            _current = _current.Prev; 
            t.Remove();
        } 
#endif 

    } 

}


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK