开发者

c# check if a given file path contains a root directory

how can i check if a given file path for a console application contains a root directory? for example, the person inputs the argument value "false" for an argument that is looking for a path. It will create the path to the default directory "false" folder. Instead I want it to only accept the argument if the provided argument is in the form of eg "C:\newpro开发者_Go百科ject". How should I do this?


Use System.IO.Path.IsPathRooted:

if(Path.IsPathRooted(path))...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜