using System;
using System.Collections;
using System.Collections.Generic;
namespace Chernobyl.Collections.Generic
{
///
/// An that is used to create
/// s. Typically this class is used in situations
/// where you you have an type that you need
/// to use but don't have an to iterate over
/// or use LINQ expressions on.
///
///
public class EnumeratorFactory : IEnumerable
{
///
/// Initializes a new instance of the
/// class.
///
/// The method that generates the
/// .
public EnumeratorFactory(Func> enumeratorFactory)
{
CreateEnumerator = enumeratorFactory;
}
///
/// Returns an enumerator that iterates through the collection.
///
///
/// A that can
/// be used to iterate through the collection.
///
public IEnumerator GetEnumerator()
{
return CreateEnumerator();
}
///
/// Returns an enumerator that iterates through a collection.
///
///
/// An object that can be used to iterate
/// through the collection.
///
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
///
/// The method that generates the .
///
public Func> CreateEnumerator { get; set; }
}
}