📜  从文件名中删除非法字符 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:54.030000             🧑  作者: Mango

代码示例1
public string RemoveInvalidChars(string filename)
{
    return string.Concat(filename.Split(Path.GetInvalidFileNameChars()));
}
public string ReplaceInvalidChars(string filename)
{
    return string.Join("_", filename.Split(Path.GetInvalidFileNameChars()));    
}