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)); } } } }
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);
}
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));
}
}
}
}