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))...
精彩评论