冒泡排序 string[] names = fileName; bool exchange; for (int i = 0; i < names.Length; i++) { exchange = false; for (int j = names.Length - 2; j >= i; j--) { string str1 = names[j]; string str2 = names[j + 1]; if (str1.CompareTo(str2) > 0) { string tmp = names[j]; names[j] = names[j + 1]; names[j + 1] = tmp; exchange = true; } } if (!exchange) { break; } }