我怎样才能获得一个给定的路径的完整路径(可以是一个目录或文件,甚至是完整路径)使用C#? [英] How can I get a full path of a given path (can be a directory or file, or even full path) using C#?
本文介绍了我怎样才能获得一个给定的路径的完整路径(可以是一个目录或文件,甚至是完整路径)使用C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到的是使用最近的新的FileInfo(路径).FullPath
,但据我所知FileInfo的是文件而已,没有目录。
The closest I get is using new FileInfo(path).FullPath
, but as far as I know FileInfo is for files only, not directory.
另请参阅我的意见<一个href="http://stackoverflow.com/questions/703281/getting-path-relative-to-the-current-working-directory/703290#703290">Jon飞碟双向的答案这里上下文。
See also my comments to Jon Skeet's answer here for context.
推荐答案
Path类还为您提供了很多很好的方法和属性,例如: GetFullPath()。请参见 MSDN 的所有细节。
The Path class also gives you a lot of nice methods and properties, e.g. GetFullPath(). See MSDN for all details.
这篇关于我怎样才能获得一个给定的路径的完整路径(可以是一个目录或文件,甚至是完整路径)使用C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文