久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='zfyzG'><style id='zfyzG'><dir id='zfyzG'><q id='zfyzG'></q></dir></style></legend>
    • <bdo id='zfyzG'></bdo><ul id='zfyzG'></ul>
  • <small id='zfyzG'></small><noframes id='zfyzG'>

    1. <tfoot id='zfyzG'></tfoot>

        <i id='zfyzG'><tr id='zfyzG'><dt id='zfyzG'><q id='zfyzG'><span id='zfyzG'><b id='zfyzG'><form id='zfyzG'><ins id='zfyzG'></ins><ul id='zfyzG'></ul><sub id='zfyzG'></sub></form><legend id='zfyzG'></legend><bdo id='zfyzG'><pre id='zfyzG'><center id='zfyzG'></center></pre></bdo></b><th id='zfyzG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zfyzG'><tfoot id='zfyzG'></tfoot><dl id='zfyzG'><fieldset id='zfyzG'></fieldset></dl></div>

        異步迭代器任務&lt;IEnumerable&lt;T&gt;&

        Asynchronous iterator Tasklt;IEnumerablelt;Tgt;gt;(異步迭代器任務lt;IEnumerablelt;Tgt;gt;)
      1. <small id='iX04G'></small><noframes id='iX04G'>

      2. <i id='iX04G'><tr id='iX04G'><dt id='iX04G'><q id='iX04G'><span id='iX04G'><b id='iX04G'><form id='iX04G'><ins id='iX04G'></ins><ul id='iX04G'></ul><sub id='iX04G'></sub></form><legend id='iX04G'></legend><bdo id='iX04G'><pre id='iX04G'><center id='iX04G'></center></pre></bdo></b><th id='iX04G'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iX04G'><tfoot id='iX04G'></tfoot><dl id='iX04G'><fieldset id='iX04G'></fieldset></dl></div>

        <tfoot id='iX04G'></tfoot>

            • <bdo id='iX04G'></bdo><ul id='iX04G'></ul>
            • <legend id='iX04G'><style id='iX04G'><dir id='iX04G'><q id='iX04G'></q></dir></style></legend>

                    <tbody id='iX04G'></tbody>
                • 本文介紹了異步迭代器任務&lt;IEnumerable&lt;T&gt;&gt;的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試實現一個返回迭代器的異步函數.思路如下:

                  I’m trying to implement an asynchronous function that returns an iterator. The idea is the following:

                      private async Task<IEnumerable<char>> TestAsync(string testString)
                      {
                          foreach (char c in testString.ToCharArray())
                          {
                              // do other work
                              yield return c;
                          }
                      }
                  

                  但是,由于 Task> 不是迭代器接口類型,因此有錯誤消息指出該函數不能是迭代器塊.有解決辦法嗎?

                  However, there is an error message that the function cannot be an iterator block because Task<IEnumerable<char>> is not an iterator interface type. Is there a solution?

                  推薦答案

                  聽起來你可能真正想要的是 IObservable<T>,有點像基于推送的異步 IEnumerable<T>.查看 Reactive Extensions,又名 Rx(在 MIT 許可的代碼)(無從屬關系)了解大量方法與 IObservable<T> 一起工作,使其像 LINQ-to-Objects 等一樣工作.

                  It sounds like what you may really be looking for is something like IObservable<T>, which is sort of like a push-based asynchronous IEnumerable<T>. See Reactive Extensions, a.k.a. Rx (code licensed under MIT) (no affiliation) for a huge host of methods that work with IObservable<T> to make it work like LINQ-to-Objects and more.

                  IEnumerable<T> 的問題在于,沒有什么可以真正使枚舉本身異步.如果您不想添加對 Rx 的依賴(這確實是 IObservable<T> 大放異彩的原因),這個替代方案可能適合您:

                  The problem with IEnumerable<T> is that there's nothing that really makes the enumeration itself asynchronous. If you don't want to add a dependency on Rx (which is really what makes IObservable<T> shine), this alternative might work for you:

                  public async Task<IEnumerable<char>> TestAsync(string testString)
                  {
                      return GetChars(testString);
                  }
                  
                  private static IEnumerable<char> GetChars(string testString)
                  {
                      foreach (char c in testString.ToCharArray())
                      {
                          // do other work
                          yield return c;
                      }
                  }
                  

                  雖然我想指出的是,在不知道異步實際上做什么的情況下,可能有更好的方法來實現您的目標.您發布的所有代碼實際上都不會異步執行任何操作,而且我真的不知道 //do other work 中的任何內容是否是異步的(在這種情況下,這不是您底層的解決方案問題雖然它會讓你的代碼編譯).

                  though I'd like to point out that without knowing what's actually being done asynchronously, there may be a much better way to accomplish your goals. None of the code you posted will actually do anything asynchronously, and I don't really know if anything in // do other work is asynchronous (in which case, this isn't a solution to your underlying problem though it will make your code compile).

                  這篇關于異步迭代器任務&lt;IEnumerable&lt;T&gt;&gt;的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                  XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                  Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                  Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                  delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                  Parse malformed XML(解析格式錯誤的 XML)
                  <legend id='8cGFK'><style id='8cGFK'><dir id='8cGFK'><q id='8cGFK'></q></dir></style></legend>

                  <i id='8cGFK'><tr id='8cGFK'><dt id='8cGFK'><q id='8cGFK'><span id='8cGFK'><b id='8cGFK'><form id='8cGFK'><ins id='8cGFK'></ins><ul id='8cGFK'></ul><sub id='8cGFK'></sub></form><legend id='8cGFK'></legend><bdo id='8cGFK'><pre id='8cGFK'><center id='8cGFK'></center></pre></bdo></b><th id='8cGFK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8cGFK'><tfoot id='8cGFK'></tfoot><dl id='8cGFK'><fieldset id='8cGFK'></fieldset></dl></div>
                    <tbody id='8cGFK'></tbody>

                    <small id='8cGFK'></small><noframes id='8cGFK'>

                    • <bdo id='8cGFK'></bdo><ul id='8cGFK'></ul>
                          1. <tfoot id='8cGFK'></tfoot>

                          2. 主站蜘蛛池模板: 香蕉大人久久国产成人av | 国产高清精品在线 | 久久精品视频在线免费观看 | 成人一区二区三区在线观看 | 91精品在线播放 | 一区二区三区国产精品 | 欧美日韩高清在线观看 | 日韩欧美在线播放 | 亚洲精品中文字幕 | 精品久久国产 | 欧美一区二区三区 | 在线免费观看黄色av | 91精品国产91久久久久游泳池 | av香港经典三级级 在线 | 91国内外精品自在线播放 | 日韩精品一区二区三区中文字幕 | 波多野结衣一区二区 | 国产精品国产成人国产三级 | 国产精品美女久久久久久免费 | 精品国产伦一区二区三区观看方式 | 亚洲性人人天天夜夜摸 | 成人精品在线观看 | 精品无码久久久久久国产 | 国产精品久久久久久久午夜 | 91国产视频在线观看 | www.jizzjizz| 日韩精品一区在线观看 | 中文字幕精品一区二区三区精品 | 国产成人高清视频 | 久久国产精品视频免费看 | 国产在线中文字幕 | www.亚洲免费 | 国产人成精品一区二区三 | 久久看看| 综合网中文字幕 | 精品国产乱码一区二区三区a | 国产福利在线看 | 一区二区三区视频在线观看 | 国产综合精品一区二区三区 | 免费观看毛片 | 2019天天操 |