49 lines
819 B
C#
49 lines
819 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Scripting.Utils;
|
|
|
|
internal class DictionaryUnionEnumerator : CheckedDictionaryEnumerator
|
|
{
|
|
private IList<IDictionaryEnumerator> _enums;
|
|
|
|
private int _current;
|
|
|
|
public DictionaryUnionEnumerator(IList<IDictionaryEnumerator> enums)
|
|
{
|
|
_enums = enums;
|
|
}
|
|
|
|
protected override object GetKey()
|
|
{
|
|
return _enums[_current].Key;
|
|
}
|
|
|
|
protected override object GetValue()
|
|
{
|
|
return _enums[_current].Value;
|
|
}
|
|
|
|
protected override bool DoMoveNext()
|
|
{
|
|
if (_current == _enums.Count)
|
|
{
|
|
return false;
|
|
}
|
|
if (_enums[_current].MoveNext())
|
|
{
|
|
return true;
|
|
}
|
|
_current++;
|
|
return DoMoveNext();
|
|
}
|
|
|
|
protected override void DoReset()
|
|
{
|
|
for (int i = 0; i < _enums.Count; i++)
|
|
{
|
|
_enums[i].Reset();
|
|
}
|
|
_current = 0;
|
|
}
|
|
}
|