相关文章  
  • 浅谈如何利用BartPE创建PE工具盘
  • Windows Mobile 2003 Second Edition 中 ActiveSync 编程模型的增强功能
  • 在完成所有绑定后仍然有许多要进行的操作
  • 在你的企业中管理Windows和应用程序
  • 动态加载用户控件的组件
  • 小心GDI+资源泄漏 -- 猜想 测试 应对全过程
  • 定时检测邮件并且自动转发的例子
  • Internet Explorer 中编辑 OLE 嵌入文档
  • 教你通过 Emit 实现动态生成一个类
  • 如何才能在10046event自由漫步
  •   推荐  
      科普之友首页   专利     科普      动物      植物        天文   考古   前沿科技
     您现在的位置在:  首页 >>文献 >>培训

    浅谈 C# 中的代码协同 (Coroutine) 执行支持6

      {
      if (position < t.elements.Length - 1)
      {
      position++;
      return true;
      }
      else
      {
      return false;
      }
      }
      
      // Declare the Reset method required by IEnumerator:
      public void Reset()
      {
      position = -1;
      }
      
      // Declare the Current property required by IEnumerator:
      public object Current
      {
      get // get_Current函数
      {
      return t.elements[position];
      }
      }
      }
      ...
      }
      
      这种笨拙的 IEnumerable 接口实现方法,实际上是将 STL 中提供控制状态的 iterator 完全自行实现,而且控制逻辑还限定于编写 IEnumerable 接口实现时的定义。就算可以通过策略 (Strategy) 模式提供一定程度的定制,但其代码逻辑过于分散,要理解一个简单调用必须查看四五处分散的代码。
      
      好在牛人总是不缺的,呵呵。
      
      Ajai Shankar 在 MSDN 上一篇非常出色的文章,COROUTINES Implementing Coroutines for .NET by Wrapping the Unmanaged Fiber API,里面通过 Wi

    页码:[1] [2] [3] [4] [5] [6] [7] [8]6页、共8页

         

          设为首页       |       加入收藏       |       广告服务       |       友情链接       |       版权申明      

    Copyriht 2007 - 2008 ©  科普之友 All right reserved