StoreImpl<T>
using System;
using System.Collections.Generic;
namespace Org.BouncyCastle.Utilities.Collections
{
internal sealed class StoreImpl<T> : IStore<T>
{
private readonly List<T> m_contents;
internal StoreImpl(IEnumerable<T> e)
{
m_contents = new List<T>(e);
}
IEnumerable<T> IStore<T>.EnumerateMatches(ISelector<T> selector)
{
List<T>.Enumerator enumerator = this.m_contents.GetEnumerator();
try {
while (enumerator.MoveNext()) {
T current = enumerator.Current;
if (selector == null || selector.Match(current))
yield return current;
}
} finally {
((IDisposable)enumerator).Dispose();
}
enumerator = default(List<T>.Enumerator);
}
}
}