如何列举出一到三位数的数字和小写字母的所有组合?
如题,我想列出一到三位数的数字和字母的所有组合,比如:
1,2,3,4,5,6,7......
1a,1b,1c,........9z...
1a1,1a2,1a3,......
用一个循环将所有的可能都Debug.writeline出来,怎么写,想了半天都没想出来。
[解决办法]
string[] m = { " ", "0", "1", "2", ... "9", "a", "b", ... "z" };
var query = from x in m
from y in m
from z in m
where x + y + z != " "
select (x + y + z).Trim();
foreach (string s in query)
Console.WriteLine(s);