Skip to content

Instantly share code, notes, and snippets.

@yutopp
Created October 2, 2021 10:49
Show Gist options
  • Save yutopp/38190f1631f63a81f12fff1a8fdb4366 to your computer and use it in GitHub Desktop.
Save yutopp/38190f1631f63a81f12fff1a8fdb4366 to your computer and use it in GitHub Desktop.
mono 5.10.1
```
path = tmp/tmp2/aaa
parent ToString() = tmp/tmp2
parent Name = tmp2
parent FullName = /home/tmp/tmp2
```
mono 6.0.0
```
path = tmp/tmp2/aaa
parent ToString() = /home/tmp/tmp2
parent Name = tmp2
parent FullName = /home/tmp/tmp2
```
using System;
using System.IO;
class Program
{
static void Main() {
var path = "tmp/tmp2/aaa";
System.Console.Write($"path = {path}\n");
var parentPath = Directory.GetParent(path).ToString();
System.Console.Write($"parent ToString() = {parentPath}\n");
var n0 = Directory.GetParent(path).Name;
System.Console.Write($"parent Name = {n0}\n");
var n1 = Directory.GetParent(path).FullName;
System.Console.Write($"parent FullName = {n1}\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment