gpt4 book ai didi

c# - 从 C# 中的完整文件路径解析目录名称

转载 作者:IT王子 更新时间:2023-10-29 04:03:02 25 4
gpt4 key购买 nike

如果我有一个字符串变量:

"C:\temp\temp2\foo\bar.txt"

我想得到

“富”

最好的方法是什么?

最佳答案

使用:

new FileInfo(@"C:\temp\temp2\foo\bar.txt").Directory.Name

关于c# - 从 C# 中的完整文件路径解析目录名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/660657/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com