C# 在方法中从Azure FileShare读取文本文件

C# 在方法中从Azure FileShare读取文本文件,c#,filestream,asp.net-core-3.1,azure-storage-files,C#,Filestream,Asp.net Core 3.1,Azure Storage Files,我想使用Azure.Storage.Files.Shareslibrary读取Azure中我的storageaccount上的文件共享中的csv文件的内容 我可以使用ShareFileClient连接到文件,但是我如何才能在代码中读取内容并处理它们(添加新行) ShareFileClient file = ConnectToFile(); Steam content = await file.OpenReadAsync(true); // gives a Stream object, that

我想使用
Azure.Storage.Files.Shares
library读取Azure中我的storageaccount上的文件共享中的csv文件的内容

我可以使用
ShareFileClient
连接到文件,但是我如何才能在代码中读取内容并处理它们(添加新行)

ShareFileClient file = ConnectToFile();
Steam content = await file.OpenReadAsync(true);
// gives a Stream object, that I cannot get to work to get the content.
流式传输此文件内容的下一步是什么?我一直在尝试让read操作与以下内容一起工作

using (Steam stream = new Stream() )
{       
 
    // The actions to read the stream go here 
}

关于如何实现这一点,您有什么建议吗?

关于这个问题,请参考以下代码

 // read
            using (var stream = await file.OpenReadAsync().ConfigureAwait(false))
            using (var reader = new StreamReader(stream)) {
                // read csv file one line by line 
                while (!reader.EndOfStream) {
                  var line =await  reader.ReadLineAsync().ConfigureAwait(false);
                    Console.WriteLine(line);
                }
            }

            //write
            ShareFileProperties properties = await file.GetPropertiesAsync().ConfigureAwait(false);
            var myPosition = properties.ContentLength;
            var newData = "42,11,58, \"N\",85,12,45, \"W\", \"Worcester\", ND"+Environment.NewLine;
            var bytes = Encoding.UTF8.GetBytes(newData);
            await file.SetHttpHeadersAsync(myPosition + bytes.Length);
            using (var writer = await file.OpenWriteAsync(overwrite: false, position:(myPosition -1)).ConfigureAwait(false)) {
               
                await writer.WriteAsync(bytes, 0, bytes.Length);
                await writer.FlushAsync();
            }

你还有其他顾虑吗?如果你没有其他顾虑,你能接受它作为一个答案吗?