我很想去:
private static bool CanMoveToSafeFolder(string filename) { return IsValidFileFormat(filename) && GetFolderIDFromFilename(filename) > 0 && HasNoViruses(filename) && VerifyFileSize(filename); } public static void HandleUploadedFile(string filename) { try { if (CanMoveToSafeFolder(filename)) { // file is OK MoveToSafeFolder(filename); } else { DeleteFile(filename); } } catch (Exception ex) { } finally { // do some things } }