string[] Mystrings = new string(){};
//把需要排序的字符串添加搭配Mystring里
...
//开始排序
for (int i = 0; i < Mystrings.Count(); i++) //每个字符串都要参与比较
{
for (int j = 1; j < Mystrings.Count(); j++) //字符串长度较长的排在前面
{
if (Mystrings[j - 1].Length < Mystrings[j].Length)
{
string temp = Mystrings[j - 1];
Mystrings[j - 1] = Mystrings[j];
Mystrings[j] = temp;
}
}
}
判断字符串的length属性,然後用冒泡排序法排序就OK了