Closed
Description
In order to reduce allocations for path generation and manipulation we need Span overloads for System.IO.Path
APIs.
Proposed API
namespace System.IO
{
public static class Path
{
public static ReadOnlySpan<char> GetDirectoryName(ReadOnlySpan<char> path);
public static ReadOnlySpan<char> GetExtension(ReadOnlySpan<char> path);
public static ReadOnlySpan<char> GetFileName(ReadOnlySpan<char> path);
public static ReadOnlySpan<char> GetFileNameWithoutExtension(ReadOnlySpan<char> path);
public static ReadOnlySpan<char> GetPathRoot(ReadOnlySpan<char> path);
public static bool HasExtension(ReadOnlySpan<char> path);
public static bool IsPathFullyQualified(ReadOnlySpan<char> path);
public static bool IsPathRooted(ReadOnlySpan<char> path);
}
}
Implementation Notes
- If the current APIs return null, these would return an empty span.