{ 1, 2, 3, 4, 5, 6 },
// { 18, 19, 20, 21, 22, 7 },
// { 17, 28, 29, 30, 31, 8 },
// { 16, 27, 26, 25, 24, 9 },
// { 15, 14, 13, 12, 11, 10 }输出成 12345678910 11 12 13 14 15 16 17 18 19...
// { 18, 19, 20, 21, 22, 7 },
// { 17, 28, 29, 30, 31, 8 },
// { 16, 27, 26, 25, 24, 9 },
// { 15, 14, 13, 12, 11, 10 }输出成 12345678910 11 12 13 14 15 16 17 18 19...
解决方案 »
- RESTORE 无法处理数据库 ,因为它正由此会话使用。建议在执行此操作时使用 master 数据库。
- C#4.0有了Tuple真是好啊
- 请教c#中自定义类的调用问题(有代码但不知怎么用)
- 求一正则
- 如果得到DataGrid的排序后当前选择行对应的DataRow
- 怎样提升C#程序的权限优先级
- 大神都来说说 “接口” 吧
- 看了 Petshop 3.0 几个文件 , 如 DataProtector.cs , 信心一下子全没有了,太难懂了 , 高手 指点 !!! up 有分 ----
- 如何获取客户端的IP地址??谢谢在线等待
- 在C#中,怎样使一个webform的最大化窗口去掉!并设置webform的大小?希望有源代码!谢谢!
- 字符串转字节问题
- 调用系统api获得文件大小和修改时间
void Main()
{
int[][] arry=new int[][]{ new int[]{ 1, 2, 3, 4, 5, 6 },
new int[]{ 18, 19, 20, 21, 22, 7 },
new int[]{ 17, 28, 29, 30, 31, 8 },
new int[]{ 16, 27, 26, 25, 24, 9 },
new int[]{ 15, 14, 13, 12, 11, 10 }}; string result=string.Join(" ",arry.SelectMany(i=>i).OrderBy(i=>i).Select(i=>i.ToString()).ToArray());
Console.WriteLine(result);
//1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31}
void Main()
{
int[][] arry=new int[][]{ new int[]{ 1, 2, 3, 4, 5, 6 },
new int[]{ 18, 19, 20, 21, 22, 7 },
new int[]{ 17, 28, 29, 30, 31, 8 },
new int[]{ 16, 27, 26, 25, 24, 9 },
new int[]{ 15, 14, 13, 12, 11, 10 }}; string result=string.Join(" ",arry.SelectMany(i=>i).OrderBy(i=>i).Select(i=>i.ToString()).ToArray());
Console.WriteLine(result);
//1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31}
// 你的需求不太明确,根据题目,貌似只需要知道数组长度就行了!
public static void PrintLines(int[][] arr)
{
string s = "";
Parallel.For(1, arr.GetLength(0) * arr.GetLength(1), x => s += x.ToString() + (x < 10 ? "" : " "));
Console.WriteLine(s.Remove(s.Length - 1));
}
// 三楼最后一个 select 可以省略掉
string result = string.Join(" ", arry.SelectMany(i => i).OrderBy(i => i).ToArray());
我那个不正确,我以为是顺序螺旋循环,但他里面的数字是断开的,所以必须全部取出来排序,然后拼接。
不可省略哦