Check whether a path is valid

前端 未结 12 1881
小蘑菇
小蘑菇 2020-11-27 03:39

I am just wondering: I am looking for a way to validate if a given path is valid. (Note: I do not want to check if a file is existing! I only want to proof the validity

12条回答
  •  Happy的楠姐
    2020-11-27 04:31

    You could try using Path.IsPathRooted() in combination with Path.GetInvalidFileNameChars() to make sure the path is half-way okay.

提交回复
热议问题