本文整理汇总了C#中System.Collections.IList.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.IList.GetEnumerator方法的具体用法?C# System.Collections.IList.GetEnumerator怎么用?C# System.Collections.IList.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.IList
的用法示例。
在下文中一共展示了System.Collections.IList.GetEnumerator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Next
public override Token Next()
{
if (cache == null)
{
// fill cache lazily
cache = new System.Collections.ArrayList();
FillCache();
iterator = cache.GetEnumerator();
}
if (!iterator.MoveNext())
{
// the cache is exhausted, return null
return null;
}
return (Token) iterator.Current;
}
示例2: IncrementToken
public override bool IncrementToken()
{
if (cache == null)
{
// fill cache lazily
cache = new System.Collections.ArrayList();
FillCache();
iterator = cache.GetEnumerator();
}
if (!iterator.MoveNext())
{
// the cache is exhausted, return false
return false;
}
// Since the TokenFilter can be reset, the tokens need to be preserved as immutable.
RestoreState((AttributeSource.State) iterator.Current);
return true;
}
示例3: Next
public override Token Next(/* in */ Token reusableToken)
{
System.Diagnostics.Debug.Assert(reusableToken != null);
if (cache == null)
{
// fill cache lazily
cache = new System.Collections.ArrayList();
FillCache(reusableToken);
iterator = cache.GetEnumerator();
}
if (!iterator.MoveNext())
{
// the cache is exhausted, return null
return null;
}
Token nextToken = (Token) iterator.Current;
return (Token) nextToken.Clone();
}