判断文件名是否有效
/// <summary> /// 判断文件名是否有效 /// </summary> /// <param name="name"></param> /// <returns></returns> public static bool IsFileNameValid(string name) { bool isFilename = true; char[] errorStr = new char[] { '/', '\\', ':', ',' , '*', '?', '>', '|','<','?','。'}; if (string.IsNullOrEmpty(name)) { isFilename = false; } else if (name.IndexOfAny(errorStr) > 0) { isFilename = false; } return isFilename; }
凡所有相,皆是虚妄。