SchemaElementLookUpTableEnumerator.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / SchemaElementLookUpTableEnumerator.cs / 1305376 / SchemaElementLookUpTableEnumerator.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 

using System; 
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics; 

namespace System.Data.EntityModel.SchemaObjectModel 
{ 
    /// 
    /// Summary description for SchemaElementLookUpTableEnumerator. 
    /// 
    internal sealed class SchemaElementLookUpTableEnumerator: IEnumerator
    where T : S
    where S : SchemaElement 
    {
        #region Instance Fields 
        private Dictionary _data = null; 
        private List.Enumerator _enumerator;
        #endregion 

        #region Public Methods
        /// 
        /// 
        /// 
        ///  
        ///  
        public SchemaElementLookUpTableEnumerator(Dictionary data,List keysInOrder)
        { 
            Debug.Assert(data != null, "data parameter is null");
            Debug.Assert(keysInOrder != null, "keysInOrder parameter is null");

            _data = data; 
            _enumerator = keysInOrder.GetEnumerator();
        } 
        #endregion 

        #region IEnumerator Members 
        /// 
        ///
        /// 
        public void Reset() 
        {
            // it is implemented explicitly 
            ((IEnumerator)_enumerator).Reset(); 
        }
 
        /// 
        ///
        /// 
        public T Current 
        {
            get 
            { 
                string key = _enumerator.Current;
                return _data[key] as T; 
            }
        }

        object System.Collections.IEnumerator.Current 
        {
            get 
            { 
                string key = _enumerator.Current;
                return _data[key] as T; 
            }
        }

        ///  
        ///
        ///  
        ///  
        public bool MoveNext()
        { 
            while ( _enumerator.MoveNext() )
            {
                if ( Current != null )
                    return true; 
            }
            return false; 
        } 
        #endregion
 
        #region IDisposable Members
        /// 
        ///
        ///  
        public void Dispose()
        { 
        } 
        #endregion
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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