且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在CloudBlobContainer中找不到Listblob()

更新时间:2023-11-19 18:49:28

ListBlobs是一种同步方法,因此在不支持同步方法的平台(例如Windows Phone)上丢失.原因是在UI线程上调用同步方法会阻塞UI,并使应用程序无响应.

ListBlobs is a synchronous method and therefore is missing on platforms that do not support synchronous methods such as Windows Phone. The reason is that calling a synchronous method on a UI thread would block the UI and make the application unresponsive.

替代方法是使用* Async重载.但是,请注意,因为.NET中没有IEnumerable的异步对应项,所以没有ListBlobsAsync.因此,您应该调用 ListBlobsSegmentedAsync 并处理它返回的延续令牌.

The alternative is to use the *Async overloads. However, please note that there is no ListBlobsAsync, because there is no async counterpart of IEnumerable in .NET. So, you should call ListBlobsSegmentedAsync and handle the continuation token that it returns.

如果您想查看示例用法,我建议您查看Azure存储客户端库的单元测试(请参见

If you would like to see an example usage, I would recommend looking at Azure Storage Client Library's unit tests (see test CloudBlobContainerListBlobsSegmentedAsync in CloudBlobContainerTest.cs).