GetStreamCache() private method

private GetStreamCache ( string name ) : Microsoft.WindowsAzure.Storage.Blob.CloudAppendBlob
name string
return Microsoft.WindowsAzure.Storage.Blob.CloudAppendBlob
        private IEnumerable <Task> GetNamedStreams(AzureBlobAppenderHelper helper)
        {
            foreach (var name in names)
            {
                yield return(Task.Run(async() =>
                {
                    using (var indexstream = new MemoryStream())
                    {
                        var writer = new StreamWriter(indexstream);

                        using (var s = new MemoryStream())
                        {
                            var blobstream = helper.GetStreamCache(name);
                            blobstream.StreamWriteSizeInBytes = 1024 * 1024 * 3;

                            foreach (var record in this.records.Where(x => x.Name.Equals(name)).OrderBy(x => x.Version))
                            {
                                record.WriteContentToStream(s);
                                var hashhex = string.Join(String.Empty, record.Hash.Select(x => x.ToString("x2")));
                                writer.WriteLine(String.Join("\t", record.Name, record.Version, hashhex, blobstream.Name));
                            }

                            await writer.FlushAsync();

                            s.Position = 0;
                            indexstream.Position = 0;

                            var indexblob = storage.CreateCloudBlobClient().GetContainerReference(container).GetAppendBlobReference(this.options.NamingPolicy.GetIndexPath(name));
                            await indexblob.CreateOrReplaceAsync();
                            await indexblob.AppendFromStreamAsync(indexstream);
                            await blobstream.CreateOrReplaceAsync();
                            await blobstream.AppendFromStreamAsync(s);
                        }
                    }
                }));
            }
        }
        private IEnumerable<Task> GetNamedStreams(AzureBlobAppenderHelper helper)
        {
            foreach (var name in names)
            {
                yield return Task.Run(async () =>
                {
                    using (var indexstream = new MemoryStream())
                    {
                        var writer = new StreamWriter(indexstream);
                        
                        using (var s = new MemoryStream())
                        {
                            var blobstream = helper.GetStreamCache(name);
                            blobstream.StreamWriteSizeInBytes = 1024*1024*3;

                            foreach (var record in this.records.Where(x => x.Name.Equals(name)).OrderBy(x => x.Version))
                            {
                                record.WriteContentToStream(s);
                                var hashhex = string.Join(String.Empty, record.Hash.Select(x => x.ToString("x2")));
                                writer.WriteLine(String.Join("\t", record.Name, record.Version, hashhex, blobstream.Name));                                
                            }

                            await writer.FlushAsync();

                            s.Position = 0;
                            indexstream.Position = 0;

                            var indexblob = storage.CreateCloudBlobClient().GetContainerReference(container).GetAppendBlobReference(this.options.NamingPolicy.GetIndexPath(name));
                            await indexblob.CreateOrReplaceAsync();
                            await indexblob.AppendFromStreamAsync(indexstream);
                            await blobstream.CreateOrReplaceAsync();
                            await blobstream.AppendFromStreamAsync(s);
                        }
                    }
                });
            }
        }