Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add File.WriteAllBytesAsync(string, Memory<byte>, CancellationToken) #41785

Closed
JamesNK opened this issue Sep 3, 2020 · 3 comments
Closed

Add File.WriteAllBytesAsync(string, Memory<byte>, CancellationToken) #41785

JamesNK opened this issue Sep 3, 2020 · 3 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.IO untriaged New issue has not been triaged by the area owner

Comments

@JamesNK
Copy link
Member

JamesNK commented Sep 3, 2020

There is an async helper method for writing to a file: File.WriteAllBytesAsync(String, Byte[], CancellationToken) Method

The method takes a byte[], potentially forcing sliced bytes to be copied to an array. Should there be an overload that supports Memory<byte>?

public static class File
{
    public static Task WriteAllBytesAsync(string path, Memory<byte> bytes, CancellationToken cancellationToken = default);
}
@JamesNK JamesNK added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Sep 3, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.IO untriaged New issue has not been triaged by the area owner labels Sep 3, 2020
@JamesNK JamesNK changed the title File.WriteAllBytesAsync(string, Memory<byte>, CancellationToken) Add File.WriteAllBytesAsync(string, Memory<byte>, CancellationToken) Sep 3, 2020
@JamesNK
Copy link
Member Author

JamesNK commented Sep 3, 2020

Stretch goal: Should WriteAllTextAsync support Memory<char>? https://docs.microsoft.com/en-us/dotnet/api/system.io.file.writealltextasync?view=netcore-3.1

@jkotas
Copy link
Member

jkotas commented Sep 3, 2020

Duplicate of #35054 (comment)

@jkotas jkotas marked this as a duplicate of #35054 Sep 3, 2020
@JamesNK
Copy link
Member Author

JamesNK commented Sep 3, 2020

Ok!

@JamesNK JamesNK closed this as completed Sep 3, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.IO untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants