char[] invalidFileChars = Path.GetInvalidFileNameChars();
foreach (char c in invalidFileChars)
{
if (attachment.FileName.IndexOf(c) != -1)
{
attachment.FileName = attachment.FileName.Replace(c, ' ');
}
}
文件名是否合法的操作(Path.GetInvalidFileNameChars())
最新推荐文章于 2023-04-19 15:22:40 发布