mak*_*iuk 4 c# .net-standard-2.0
IAsyncEnumerable除了“ What's New c#8.0”文章中的一些提及之外,真的很难找到关于的任何信息。尝试在启用了netstandard 2.0和C#8的Visual Studio 2019中使用它,它的确可以识别该类,但是在构建时出现了很多错误:
C#8支持这些功能。但是,这不适用于.Net标准2.0
适用于
.NET Core 3.0预览版3
.NET Standard 2.1预览
您将必须获得其中一个预览。
您可以在此处找到有关.Net Core 3 Preview的更多信息。
对于 .NET Standard 2.0,您应该安装 Microsoft.Bcl.AsyncInterfaces
https://www.nuget.org/packages/Microsoft.Bcl.AsyncInterfaces/
小智 5
弗拉德的答案是正确的。
例如:MyDummyLib.csproj
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<AssemblyName>MyDummyLib</AssemblyName>
<RootNamespace>MyDummyLib</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
458 次 |
| 最近记录: |