List<string> list = new List<string>();
for (int i = 0; i < 26;i++ )
{
StringBuilder sb = new StringBuilder();
for(int j=0;j<=i;j++)
{
sb.Append(Convert.ToString(Convert.ToChar( 97+j)));
}
list.Add(sb.ToString());
}
假如你就这(a,ab,abc,abcd,.....abcdefghijklmnopqrstuvwxyz)不变的话,而且还想高性能:
const string _1 = "a";
const string _2 = "ab";
const string _26= "abcdefghijklmnopqrstuvwxyz";
string[] array = new string[26]{_1,_2 ...... ,_26};
没有零碎字符串,没有垃圾回收,嘿嘿
————————————————————————
再给你一种方法,开开思路,用得着双循环码?
string chars = "abcdefghijklmnopqrstuvwxyz";
List<string> list = new List<string>();
for (int i=1,i<=26,i++)
{
list.Add(chars.Subtring(0,i));
}
只此,OK了