当前位置: 首页>>代码示例>>C#>>正文


C# IIterator.HasNext方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:param2000,项目名称:HeadFirstDesignPattern,代码行数:8,代码来源:NewWaitressWithIterator.cs

示例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);
     }
 }
开发者ID:pavelanikhimovski,项目名称:design-patterns,代码行数:10,代码来源:Waitress.cs

示例3: IEnumeratorAdapter

 public IEnumeratorAdapter(IIterator enume)
 {
     if (enume != null)
     {
         this.enume = enume;
         if (enume.HasNext())
         {
             this.current = enume.Next();
         }
     }
 }
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:11,代码来源:JavaListInterface.cs

示例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();
        }
开发者ID:vmp,项目名称:CSharpExamples,代码行数:12,代码来源:Waitress.cs

示例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);
 }
开发者ID:DONGChuan,项目名称:LGame,代码行数:20,代码来源:ActorSet.cs

示例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;
 }
开发者ID:tehkyle,项目名称:xmp-core-dotnet,代码行数:26,代码来源:XmpIterator.cs


注:本文中的IIterator.HasNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。