C# 8.0 抢先看 -- Async Stream (2)
2021-02-04 18:14
标签:ati str mis visual 微软 like value complete yield 在目前版本中异步迭代使用 yield return 的暂时解决方案说明。 上一篇简单示范了在类中实践 Async Stream 的方式, 如果今天是一个方法要回传 IAsyncEnumerable 我们一样就拿 ReadLineAsync 来示范,首先建立一个类实践 IAsyncEnumerator 接着建立另外一个类, 这个类很简单,只包含一个静态的方法 async static public IAsyncEnumerable 程序没有错,但编译过不了,观察一下错误消息: 很明显,编译器需要两个类型 (1)? System.Threading.Tasks.ManualResetValueTaskSourceLogic 补上去后就大功告成,可以快乐地异步 yielld return。故事还没完,待续........ 原文:大专栏 C# 8.0 抢先看 -- Async Stream (2) C# 8.0 抢先看 -- Async Stream (2) 标签:ati str mis visual 微软 like value complete yield 原文地址:https://www.cnblogs.com/petewell/p/11457971.html
本篇文章使用环境
开发环境 Visual Studio 2019 Preview 1 (16.0.0 Preview 1)
框架?????? .NET Core 3.0.0-preview-27122-01
编译器??? C# 8.0 beta
internal class AsyncEnumerator : IAsyncEnumerator
async static public IAsyncEnumerable
error CS0656: Missing compiler required member ‘System.Threading.Tasks.ManualResetValueTaskSourceLogic`1.GetStatus‘
error CS0656: Missing compiler required member ‘System.Threading.Tasks.ManualResetValueTaskSourceLogic`1.get_Version‘
error CS0656: Missing compiler required member ‘System.Threading.Tasks.ManualResetValueTaskSourceLogic`1.OnCompleted‘
error CS0656: Missing compiler required member ‘System.Threading.Tasks.ManualResetValueTaskSourceLogic`1.Reset‘
error CS0656: Missing compiler required member ‘System.Threading.Tasks.ManualResetValueTaskSourceLogic`1.SetException‘
error CS0656: Missing compiler required member ‘System.Threading.Tasks.ManualResetValueTaskSourceLogic`1.SetResult‘
error CS0656: Missing compiler required member ‘System.Runtime.CompilerServices.IStrongBox`1.get_Value‘
error CS0656: Missing compiler required member ‘System.Runtime.CompilerServices.IStrongBox`1.Value‘
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks.Sources;
namespace System.Threading.Tasks{
internal struct ManualResetValueTaskSourceLogic
文章标题:C# 8.0 抢先看 -- Async Stream (2)
文章链接:http://soscw.com/index.php/essay/51004.html