#region Copyright
// Advanced.Data.Provider.AdpProviderEnumerator
//
// Copyright (C) 2004 Astrein Engenharia de Manuteno S/A
// Copyright (C) 2004 Everaldo Canuto <everaldo_canuto@yahoo.com.br>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 enumerablele Place, Suite 330, Boston, MA 02111-1307 USA
#endregion
using System;
using System.Collections;
namespace Advanced.Data.Provider{
/// <summary>
/// Represents an enumerator that can iterate through the <see cref='AdpProviderCollection'/>.
/// </summary>
public class AdpProviderEnumerator : object, IEnumerator
{
#region Fields
private IEnumerator enumerator;
private IEnumerable enumerable;
#endregion
#region Contructors and destructors
/// <summary>
/// Initializes a new instance of the <see cref='AdpProviderEnumerator'/> class.
/// </summary>
/// <param name="mappings"><see cref='AdpProviderCollection'/> object.</param>
public AdpProviderEnumerator(AdpProviderCollection mappings)
{
this.enumerable = ((IEnumerable)(mappings));
this.enumerator = enumerable.GetEnumerator();
}
#endregion
#region Public properties
/// <summary>
/// Gets the current element in the collection.
/// </summary>
object IEnumerator.Current
{
get
{
return enumerator.Current;
}
}
/// <summary>
/// Gets the current element in the collection.
/// </summary>
public AdpProvider Current
{
get
{
return ((AdpProvider) ((DictionaryEntry) (enumerator.Current)).Value);
}
}
#endregion
#region Public methods
/// <summary>
/// Advances the enumerator to the next element of the collection.
/// </summary>
/// <returns><see langword='true'/> if the enumerator was successfully advanced to the next element; <see langword='false'/> if the enumerator has passed the end of the collection.</returns>
bool IEnumerator.MoveNext()
{
return enumerator.MoveNext();
}
/// <summary>
/// Advances the enumerator to the next element of the collection.
/// </summary>
/// <returns><see langword='true'/> if the enumerator was successfully advanced to the next element; <see langword='false'/> if the enumerator has passed the end of the collection.</returns>
public bool MoveNext()
{
return enumerator.MoveNext();
}
/// <summary>
/// Sets the enumerator to its initial position, which is before the first element in the collection.
/// </summary>
void IEnumerator.Reset()
{
enumerator.Reset();
}
/// <summary>
/// Sets the enumerator to its initial position, which is before the first element in the collection.
/// </summary>
public void Reset()
{
enumerator.Reset();
}
#endregion
}
}
|