int[,] vList = { 
    { 1, 1, 1 }, 
    { 2, 2, 2 }, 
    { 3, 3, 3 }, 
};
int[] vIndexs = new int[vList.GetLength(1)];for (int k = 0; k < vList.GetLength(1); k++)
    vIndexs[k] = 0;bool vBreak = false;
do
{
    for (int j = 0; j < vList.GetLength(1); j++)
        textBox1.AppendText(vList[vIndexs[j], j].ToString());
    textBox1.AppendText("\r\n");
    vBreak = true;
    for (int j = 0; j < vList.GetLength(1); j++)
        if (vIndexs[j] + 1 < vList.GetLength(0))
        {
            vIndexs[j]++;
            for (int i = 0; i < j; i++) vIndexs[i] = 0;
            vBreak = false;
            break;
        }
}
while (!vBreak);

解决方案 »

  1.   

    我补充个用递归的
    using System;namespace Test
    {
        class Program
        {
            static void Link(int[,] vList, int result, int n)
            {
                n--;
                foreach (int i in vList)
                {
                    int current = result * 10 + i;
                    if (n == 0)
                         Console.WriteLine(current);
                    else
                         Link(vList, current, n);
                }
            }
            static void Main(string[] args)
            {
                int[,] vList = { { 1, 1, 1 }, { 2, 2, 2 }, { 3, 3, 3 } };
                int n = 3;
                Link(vList, 0, n);
            }
        }
    }
      

  2.   

    适合不适合测试一下不就知道的事情?
    int[,] vList = { 
        { 1, 1, 1 }, 
        { 2, 2, 2 }, 
        { 3, 3, 3 }, 
        { 4, 4, 4 }, 
        { 3, 3, 3 }, 
        //.....这里不用我写完吧,如果有规律可以用代码赋初值
        { 26, 26, 26 }, 
        { 27, 27, 27 }, 
    };