1 string FilterfileName(string strName) 2 { 3 string result=string.Empty ; 4 if (string.IsNullOrWhiteSpace(strName)) 5 { 6 //do something 7 } 8 else 9 { 10 result = strName.Replace("\", "_").Replace("/", "_").Replace(":", "_") 11 .Replace("*","_").Replace("?","_").Replace("<","_") 12 .Replace(">","_").Replace("|","_").Replace(""","_"); 13 } 14 return result; 15 }