문제

I noticed that GetInvalidFileNameChars() method is missing in Silverlight. What is the best way to validate file names in this case?

도움이 되었습니까?

해결책

Make use of regex,

string pattern = "[\\~#%&*{}/:<>?|\"-]";
string replacement = " ";

Regex regEx = new Regex(pattern);
string final = Regex.Replace(regEx.Replace(input, replacement), @"\s+", " ");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top