C# 下载文件时出现Azure Blob存储问题
我正在开发允许用户下载Azure Blob存储项目的功能 我正在尝试使用以下方法获取斑点列表:C# 下载文件时出现Azure Blob存储问题,c#,azure,azure-storage-blobs,C#,Azure,Azure Storage Blobs,我正在开发允许用户下载Azure Blob存储项目的功能 我正在尝试使用以下方法获取斑点列表: var list = await container.GetBlobsAsync(BlobTraits.All, BlobStates.All, string.Empty).ConfigureAwait(false); 以下是我的错误: 错误CS1061“ConfiguredCancelableAsyncEnumerable”不包含“GetAwaiter”的定义,并且找不到接受“Configure
var list = await container.GetBlobsAsync(BlobTraits.All, BlobStates.All, string.Empty).ConfigureAwait(false);
以下是我的错误:
错误CS1061“ConfiguredCancelableAsyncEnumerable”不包含“GetAwaiter”的定义,并且找不到接受“ConfiguredCancelableAsyncEnumerable”类型的第一个参数的可访问扩展方法“GetAwaiter”(是否缺少using指令或程序集引用?
异步是否可用于C#7.3?或者使用异步调用来获取容器中我需要升级到8.0 C#的所有blob
如果我将代码更改为:
await foreach (BlobItem page in container.GetBlobsAsync(BlobTraits.None, BlobStates.None, string.Empty))
{
yield return container.GetBlobClient(page.Name);
}
那么我有一个错误:
错误CS8370功能“异步流”在C#7.3中不可用。请使用8.0或更高版本的语言。
我知道GetBlobsAsync()返回
AsyncPageable
,我假设它只在C#8.0中可用我可以想到以下两个选项:
var blobs = blobContainerClient.GetBlobsAsync()
List<BlobItem> blobList = new List<BlobItem>();
IAsyncEnumerator<BlobItem> enumerator = blobs.GetAsyncEnumerator();
try
{
while (await enumerator.MoveNextAsync())
{
blobList.Add(enumerator.Current);
}
}
finally
{
await enumerator.DisposeAsync();
}
var blobs=blobContainerClient.GetBlobsAsync()
List blobList=新列表();
IAsyncEnumerator枚举器=blobs.GetAsyncEnumerator();
尝试
{
while(等待枚举器.MoveNextAsync())
{
添加(枚举数.Current);
}
}
最后
{
等待枚举器。DisposeAsync();
}
以下是我能想到的两个选项:
var blobs = blobContainerClient.GetBlobsAsync()
List<BlobItem> blobList = new List<BlobItem>();
IAsyncEnumerator<BlobItem> enumerator = blobs.GetAsyncEnumerator();
try
{
while (await enumerator.MoveNextAsync())
{
blobList.Add(enumerator.Current);
}
}
finally
{
await enumerator.DisposeAsync();
}
var blobs=blobContainerClient.GetBlobsAsync()
List blobList=新列表();
IAsyncEnumerator枚举器=blobs.GetAsyncEnumerator();
尝试
{
while(等待枚举器.MoveNextAsync())
{
添加(枚举数.Current);
}
}
最后
{
等待枚举器。DisposeAsync();
}
我需要向csproj文件添加什么?或者这就是我升级到C#8.0的方式?不过,我认为我们还没有准备好进入C#8.0。感谢您的帮助和时间来关注我的问题!我需要向csproj文件添加什么?或者这就是我升级到C#8.0的方式?不过,我认为我们还没有准备好进入C#8.0。感谢您的帮助和时间来关注我的问题!