Q: Why doesn't my streamwriter write to my file? I have a list of objects and I am trying to write a list of some of them to a .txt file and then upload to blob storage. The file is created and uploaded fine, but it does not contain any text. Here is my attempt:

        private async Task WriteChangedFileAsync(DataChange<StudentLookupData>[] changedResults, string containerName, string fileName)
        {
            var changesStream = new MemoryStream();
            var streamWriter = new StreamWriter(changesStream);

            foreach (DataChange<StudentLookupData> studentData in changedResults)
            {
                if (studentData.Change == ChangeType.Added)
                {
                    streamWriter.WriteLine("Added:");
                    streamWriter.WriteLine(studentData.Data.StudentCode);
                }
                else if (studentData .Change == ChangeType.Removed)
                {
                    streamWriter.WriteLine("Deleted:");
                    streamWriter.WriteLine(studentData .Data.StudentCode);
                }
            }
            await _fileStore.WriteFileAsync(new FileData()
            {
                Container = containerName,
                Name = fileName,
                ContentType = AppSettingsConstants.ContentTypes.Text,
                FileStream = changesStream
            }, true);
        }
    }

Can anyone please point out where I am going wrong here? Thank you!
