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 Path.TryGetTempPath() #25535

Closed
JeremyKuhne opened this issue Mar 20, 2018 · 4 comments
Closed

Add Path.TryGetTempPath() #25535

JeremyKuhne opened this issue Mar 20, 2018 · 4 comments
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.IO
Milestone

Comments

@JeremyKuhne
Copy link
Member

From API proposal #25173.

Need to add:

namespace System.IO
{
    public static class Path
    {
        public static bool TryGetTempPath(Span<char> destination, out int charsWritten);
    }
}

Returns false if the destination isn't large enough to fit the full path into.

@MarcoRossignoli
Copy link
Member

MarcoRossignoli commented Mar 20, 2018

@JeremyKuhne if you want i can start with this, feel free to assign to me

@jkotas
Copy link
Member

jkotas commented Mar 21, 2018

@JeremyKuhne Do we have examples of where the no-allocation version of this API makes a difference?

You are about to create a temporary file. Creating a temporary file is orders of magnitude more expensive operation than just allocating a string.

I think the no-allocation version of these APIs are adding negative value to the platform.

@jkotas
Copy link
Member

jkotas commented Mar 21, 2018

(Add Path.TryGetRelativePath() and Path.TryGetFullPath() are fine.)

@JeremyKuhne
Copy link
Member Author

JeremyKuhne commented Jun 19, 2018

Video

Closing for now until we re-review the API proposal.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-System.IO
Projects
None yet
Development

No branches or pull requests

4 participants