public static string CreateTempFileNameByExt(string ext) { if (Str.IsEmptyStr(ext)) { ext = "tmp"; } if (ext[0] == '.') { ext = ext.Substring(1); } while (true) { string newFilename; string fullPath; string randStr; randStr = Str.GenRandStr(); newFilename = "__" + randStr + "." + ext; fullPath = CreateTempFileName(newFilename); if (IO.IsFileExists(fullPath) == false) { return(fullPath); } } }