Skip to content

Commit 91c42c6

Browse files
committed
Update FilePolyfill.cs
1 parent 064b3ee commit 91c42c6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Polyfill/FilePolyfill.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ public static async Task AppendAllLinesAsync(string path, IEnumerable<string> co
109109
await File.AppendAllLinesAsync(path, contents, encoding, cancellationToken);
110110
#else
111111
using var stream = new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.None);
112-
using var streamWriter = new StreamWriter(stream, encoding);
112+
using var writer = new StreamWriter(stream, encoding);
113113

114114
foreach (var content in contents)
115115
{
116-
await streamWriter.WriteLineAsync(content);
116+
await writer.WriteLineAsync(content);
117117
}
118118

119-
await streamWriter.FlushAsync();
119+
await writer.FlushAsync();
120120
#endif
121121
}
122122

@@ -152,11 +152,11 @@ public static async Task AppendAllTextAsync(string path, string? contents, Encod
152152
{
153153
#if NETFRAMEWORK || NETSTANDARD2_0
154154
using var stream = new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.None);
155-
using var streamWriter = new StreamWriter(stream, encoding);
155+
using var writer = new StreamWriter(stream, encoding);
156156

157-
await streamWriter.WriteAsync(contents);
157+
await writer.WriteAsync(contents);
158158

159-
await streamWriter.FlushAsync(cancellationToken);
159+
await writer.FlushAsync(cancellationToken);
160160
#else
161161
await File.AppendAllTextAsync(path, contents, encoding, cancellationToken);
162162
#endif
@@ -333,8 +333,6 @@ public static async IAsyncEnumerable<string> ReadLinesAsync(string path, Encodin
333333
}
334334
#endif
335335

336-
337-
338336
/// <summary>
339337
/// Asynchronously creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is truncated and overwritten.
340338
/// </summary>

0 commit comments

Comments
 (0)