{"version":"1.0","published":"2023-11-20 21:26:53","image_url":"https://cdn-ak.f.st-hatena.com/images/fotolife/x/xin9le/20231120/20231120210939.png","url":"https://xin9le.hatenablog.jp/entry/2023/11/20/212653","provider_url":"https://hatena.blog","title":"Path.GetDirectoryName() \u306f overload \u306b\u3088\u3063\u3066\u6319\u52d5\u304c\u7570\u306a\u308b","author_url":"https://blog.hatena.ne.jp/xin9le/","type":"rich","width":"100%","blog_title":"xin9le.net","categories":[".NET","Tips"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fxin9le.hatenablog.jp%2Fentry%2F2023%2F11%2F20%2F212653\" title=\"Path.GetDirectoryName() \u306f overload \u306b\u3088\u3063\u3066\u6319\u52d5\u304c\u7570\u306a\u308b - xin9le.net\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190","author_name":"xin9le","provider_name":"Hatena Blog","blog_url":"https://xin9le.hatenablog.jp/","description":"\u4e45\u3005\u306b Path.GetDirectoryName() \u3092\u4f7f\u3063\u305f\u3089\u3001\u4ef6\u540d\u306e\u901a\u308a\u306e\u6319\u52d5\u306b\u5f15\u3063\u639b\u304b\u308a\u307e\u3057\u305f\u3002\u6587\u7ae0\u3067\u8aac\u660e\u3059\u308b\u3088\u308a\u3082\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u898b\u305f\u65b9\u304c\u65e9\u3044\u306e\u3067\u3001\u4ee5\u4e0b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002 const string fileName = \"A/B/C/D.cs\"; var dir1 = Path.GetDirectoryName(fileName); dir1.Dump(\"string\"); // A\\B\\C var dir2 = Path.GetDirectoryName(fileName.AsSpan()); dir2.Dump(\"ReadOnlySpan<char>\"); // A/B/C \u3054\u89a7\u306e\u2026"}