﻿// Decompiled with JetBrains decompiler
// Type: System.Xml.Schema.XmlSchemaCollectionEnumerator
// Assembly: System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 50ABAB51-7DC3-4F0A-A797-0D0C2D124D60
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Xml.dll

using System.Collections;
using System.Runtime;

namespace System.Xml.Schema
{
  /// <summary>
  /// Supports a simple iteration over a collection. This class cannot be inherited.
  /// </summary>
  public sealed class XmlSchemaCollectionEnumerator : IEnumerator
  {
    private IDictionaryEnumerator enumerator;

    object IEnumerator.Current
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return (object) this.Current;
      }
    }

    /// <summary>
    /// Gets the current <see cref="T:System.Xml.Schema.XmlSchema"/> in the collection.
    /// </summary>
    /// 
    /// <returns>
    /// The current XmlSchema in the collection.
    /// </returns>
    public XmlSchema Current
    {
      get
      {
        XmlSchemaCollectionNode schemaCollectionNode = (XmlSchemaCollectionNode) this.enumerator.Value;
        if (schemaCollectionNode != null)
          return schemaCollectionNode.Schema;
        return (XmlSchema) null;
      }
    }

    internal XmlSchemaCollectionNode CurrentNode
    {
      get
      {
        return (XmlSchemaCollectionNode) this.enumerator.Value;
      }
    }

    internal XmlSchemaCollectionEnumerator(Hashtable collection)
    {
      this.enumerator = collection.GetEnumerator();
    }

    void IEnumerator.Reset()
    {
      this.enumerator.Reset();
    }

    bool IEnumerator.MoveNext()
    {
      return this.enumerator.MoveNext();
    }

    /// <summary>
    /// Advances the enumerator to the next schema in the collection.
    /// </summary>
    /// 
    /// <returns>
    /// true if the move was successful; false if the enumerator has passed the end of the collection.
    /// </returns>
    public bool MoveNext()
    {
      return this.enumerator.MoveNext();
    }
  }
}
