dotnet / dotnet/dotnet-api-docs
Path.GetFileName behavior change on .NET Core
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
In .NET Core we consider `Path.GetPathRoot()` when finding the filename. The concept of `Path.VolumeSeparatorChar` is only relevant on Windows 9x machines. So:
**.NET Framework**
```
The characters after the last directory separator character in path. If the last character of path is a directory or volume separator character, this method returns Empty.
```
**.NET Core**
```
The characters after the last directory separator character after the path root (see Path.GetPathRoot) in path. If the path only contains a root, returns empty.
```
We should add to `Path.VolumeSeparatorChar` that we recommend not using it directly as it is a Win9x anachronism. Use `Path.GetPathRoot` to determine path roots.
Contributor guide
Assessment
This issue has not been assessed yet.