小编wel*_*man的帖子

如何使用 Filehelpers 从 Azure 文件存储读取流

我正在尝试使用 FileHelpers 从 Azure 文件存储读取 csv 文件。这是如何运作的?

我可以连接到 azure 文件存储并构建对 te 文件的引用。这是通过循环遍历目录和文件来完成的,在本例中,这些被命名为子目录和文件名。

代码:

//connect to storage account
CloudStorageAccount storageAccount = new CloudStorageAccount("link to account and credentials");
//connect to file client
CloudFileClient fileClient = storageAccount.CreateCloudFileClient();
//create cloudfileshare to in process
CloudFileShare inprocessShare = fileClient.GetShareReference("inprocess");
//get reference to root directory of inprocess share
CloudFileDirectory inprocessRootDir = inprocessShare.GetRootDirectoryReference();
//get reference to the subdirectory
CloudFileDirectory inprocessDir = inprocessRootDir.GetDirectoryReference(subdirectory);
//get reference to the current file 
CloudFile destfile = inprocessDir.GetFileReference(filename);
Run Code Online (Sandbox Code Playgroud)

这可以获取对我要处理的文件的引用。

当我使用 StreamReader 时,我可以使用以下代码,这可以工作:

\\open stream …
Run Code Online (Sandbox Code Playgroud)

c# csv filehelpers azure azure-storage

3
推荐指数
1
解决办法
2672
查看次数

标签 统计

azure ×1

azure-storage ×1

c# ×1

csv ×1

filehelpers ×1