System::IO::Path::CheckPath 方法

Path::CheckPath method

通过检查指定路径是否包含无效字符来确定其是否有效。如果路径包含无效字符,将抛出异常。

static void System::IO::Path::CheckPath(const String &path, const String &msg=s_msg_path, bool allow_empty=true)
ParameterType描述
路径const String&要检查的路径
msgconst String&传递给异常对象构造函数的消息
allow_emptybool指定空字符串或 null 字符串是否应被视为有效路径(true)或无效路径(false);如果此参数为 false 且 path 为空,则会抛出 ArgumentException;如果此参数为 false 且 path 为 null,则会抛出 ArgumentNullException。

另见