【发布时间】:2021-12-23 17:09:38
【问题描述】:
我想从 Blob 存储中检索 2 个 Xml 文件并使用 c# 返回这些文件。不用担心连接、容器名和文件名。 我尝试使用下面的代码从 blob 中获取 xml 作为字符串并作为列表返回,但我需要一个作为 Xmlfile 的返回。
public List<string> GetXmlFiles(List<string> Xmlname)
{
string storageConnectionString = "";
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("ContainerName");
CloudBlockBlob blob = container.GetBlockBlobReference("fileName");
string xml =blob.DownloadTextAsync().ToString();
List<string> XmlFile = new List<string>(xml.Split(' '));
return XmlFile;
}
【问题讨论】:
-
欢迎使用 stackoverflow。到目前为止,您自己尝试过什么?你遇到了什么问题?你研究了什么?请编辑您的问题以包含更多信息。我推荐taking the tour,以及阅读how to ask a good question和what's on topic。
标签: c# .net azure azure-blob-storage