質問

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