-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.IOgood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Background and motivation
The File class has all methods for bytes which also exist for text except of appending data. Not only that it fits into the api surface by filling this gap is also saves us writing more than one line of code.
API Proposal
namespace System.IO;
public class File
{
+ public static void AppendAllBytes(string path, ReadOnlySpan<byte> data);
+ public static Task AppendAllBytesAsync(string path, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default);
public static void AppendAllText(string path, string? contents);
public static Task AppendAllTextAsync(string path, string? contents, CancellationToken cancellationToken = default);
}
API Usage
byte[] data = File.ReadAllBytes("C:\\1.bin");
File.AppendAllBytes("C:\\2.bin", data);
Alternative Designs
No response
Risks
No response
colejohnson66, shaggygi, omariom, Tan90909090 and jozkee
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.IOgood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors