http://bbs.csdn.net/topics/370037670获取数列

解决方案 »

  1.   

    http://www.cnblogs.com/snowdust/archive/2010/01/20/1652161.html
      

  2.   


        protected void Button4_Click(object sender, EventArgs e)
        {
            string s = "1,2,3";
            string[] a= s.Split(',');
            string[] b = a;
            this.Title = "";
            for (int i=0; i < a.Length; i++)
            {
                for (int j=0; j < b.Length; j++)
                {
                    //Console.WriteLine(i + j);
                    this.Title += "," + a[i] + b[j];
                }
            }
            this.Title = this.Title.Substring(1);
        }
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
     
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                int n = 3;
                string[] are = { "0", "1", "2", "3" };
                var result = are.Select(x => new string[] { x });
                for (int i = 0; i < n - 1; i++)
                {
                    result = result.SelectMany(x => are.Where(y => y.CompareTo(x.First()) < 0).Select(y => new string[] { y }.Concat(x).ToArray()));
                }
                foreach (var item in result)
                {
                    Console.WriteLine(string.Join(", ", item));
                }
            }
        }
    }