本文整理汇总了C#中IIterator.HasNext方法的典型用法代码示例。如果您正苦于以下问题:C# IIterator.HasNext方法的具体用法?C# IIterator.HasNext怎么用?C# IIterator.HasNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IIterator
的用法示例。
在下文中一共展示了IIterator.HasNext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IteratorPrinter
private void IteratorPrinter(IIterator iterator)
{
while (iterator.HasNext())
{
var menuItem = (MenuItem) iterator.Next();
Console.WriteLine(String.Format("Name={0} Description={1} Vege?={2} Price={3}", menuItem.Name, menuItem.Description, menuItem.Vegetarian, menuItem.Price));
}
}
示例2: PrintMenu
private void PrintMenu(IIterator iterator)
{
while (iterator.HasNext())
{
MenuItem menuItem = (MenuItem) iterator.Next();
Console.Write(menuItem.Name + ", ");
Console.Write(menuItem.Price + " -- ");
Console.WriteLine(menuItem.Description);
}
}
示例3: IEnumeratorAdapter
public IEnumeratorAdapter(IIterator enume)
{
if (enume != null)
{
this.enume = enume;
if (enume.HasNext())
{
this.current = enume.Next();
}
}
}
示例4: PrintMenu
public String PrintMenu(IIterator iterator)
{
StringBuilder sb = new StringBuilder();
while (iterator.HasNext()) {
MenuItem menuItem = (MenuItem)iterator.Next();
sb.Append(menuItem.Name + ", ");
sb.Append(menuItem.Price + " -- ");
sb.Append(menuItem.Description + "\n");
}
return sb.ToString();
}
示例5: FinishToArray
private static Actor[] FinishToArray(Actor[] r, IIterator it)
{
int i = r.Length;
while (it.HasNext())
{
int cap = r.Length;
if (i == cap)
{
int newCap = ((cap / 2) + 1) * 3;
if (newCap <= cap)
{
if (cap == int.MaxValue)
newCap = int.MaxValue;
}
r = (Actor[])CollectionUtils.CopyOf(r, newCap);
}
r[i++] = (Actor)it.Next();
}
return (i == r.Length) ? r : (Actor[])CollectionUtils.CopyOf(r, i);
}
示例6: IterateChildrenMethod
/// <summary>Handles the iteration of the children or qualfier</summary>
/// <param name="iterator">an iterator</param>
/// <returns>Returns if there are more elements available.</returns>
private bool IterateChildrenMethod(IIterator iterator)
{
if (_enclosing._skipSiblings)
{
// setSkipSiblings(false);
_enclosing._skipSiblings = false;
_subIterator = Enumerable.Empty<object>().Iterator();
}
// create sub iterator for every child,
// if its the first child visited or the former child is finished
if ((!_subIterator.HasNext()) && iterator.HasNext())
{
var child = (XmpNode)iterator.Next();
_index++;
_subIterator = new NodeIterator(_enclosing, child, _path, _index);
}
if (_subIterator.HasNext())
{
_returnProperty = (IXmpPropertyInfo)_subIterator.Next();
return true;
}
return false;
}