using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
using System.Text;
using System.Diagnostics;

namespace Hecha.Test
{
class Program
{
static void Main(string[] args)
{
List<string>[] aa = new List<string>[5];
List<string> a = new List<string> { "张", "李"};
List<string> b = new List<string> { "三", "四"};
List<string> c = new List<string> { "在", "不在" };
List<string> d = new List<string> { "家", "公司" };
List<string> e = new List<string> { "打游戏", "吃饭" };
aa[0] = a;
aa[1] = b;
aa[2] = c;
aa[3] = d;
aa[4] = e;

ArrGroup ff = new ArrGroup(aa);
ff.mySelf();
ArrayList dataSource = ff._firstList;

for (int i = 0; i < dataSource.Count; i++)
Console.Write(dataSource[i].ToString()+"\r\n");

Console.Read();
}
class ArrGroup
{
List<string>[] intList;
ArrayList firstList = new ArrayList();
public ArrayList _firstList
{
get
{
return this.firstList;
}
}
public ArrGroup(List<string>[] intList)
{
this.intList = intList;
firstList.AddRange(intList[0]);
}

public void mySelf()
{
for (int i = 1; i < intList.Length; i++)
Display(intList[i]);
}
string strCount;
private void Display(List<string> list)
{
strCount = string.Empty;
for (int i = 0; i < firstList.Count; i++)
{
for (int j = 0; j < list.Count; j++)
{
strCount += firstList[i].ToString() + list[j].ToString() + "&";
}
}
firstList.Clear();
firstList.AddRange(strCount.Split('&'));
firstList.RemoveAt(firstList.Count - 1);
}
}
}
}

对N个数组进行操作。先把这N个一维数组合并成一个2为数组;然后进行操作的更多相关文章

  1. php数组实现根据某个键值将相同键值合并生成新二维数组的方法

    $infos = array( array( 'a' => 36, 'b' => 'xa', 'c' => '2015-08-28 00:00:00', 'd' => '201 ...

  2. 两个list合并成一个list的操作

    addAll  添加另一集合里面的元素 add 添加整个集合包括 [] Stream 操作 合并两个lis  出自http://www.it1352.com/963663.html public cl ...

  3. PHP将两个二维数组合并为一个二维数组的方法

    $a = array(0 => Array(id => 66,class_name => math),1 => Array(id => 67,class_name =&g ...

  4. 从C过渡到C++——换一个视角深入数组[初始化](1)

    从C过渡到C++--换一个视角深入数组[初始化](1) 目录 从C过渡到C++--换一个视角深入数组[初始化](1) 数组的初始化 从C入手 作用域 代码块作用域 文件作用域 原型作用域 函数作用域 ...

  5. 如何用一个for循环打印出一个二维数组

    思路分析: 二维数组在内存中默认是按照行存储的,比如一个二维数组{{1,2,3,},{4,5,6}},它在内存中存储的顺序就是1.2.3.4.5.6,也就是说,对于这6个数组元素,按照从0到5给它们编 ...

  6. PHP方便快捷的将二维数组中元素的某一列值抽离出来作为此二维数组内元素的key

    得益于PHP的强大的内置数组函数array_column();array_combine(); 举个小栗子: <?php // 先查询出用户的基本信息 $userArray = [['id' = ...

  7. LSM树——LSM 将B+树等结构昂贵的随机IO变的更快,而代价就是读操作要处理大量的索引文件(sstable)而不是一个,另外还是一些IO被合并操作消耗。

    Basic Compaction 为了保持LSM的读操作相对较快,维护并减少sstable文件的个数是很重要的,所以让我们更深入的看一下合并操作.这个过程有一点儿像一般垃圾回收算法. 当一定数量的ss ...

  8. 字符串操作函数:JSON.parse()与JSON.stringify()的区别,字符串转数组 str.split(','),数组转字符串String(),以及对象拼接合并Object.assign(),数组拼接合并concat()

    1.JSON.parse()  把字符串转化为 json 对象 例如 arr={ , "site":"www.runoob.com" } var obj = J ...

  9. java 写一个"HelloJavaWorld你好世界"输出到操作系统文件Hello.txt文件中

    package com.beiwo.homework; import java.io.File; import java.io.FileOutputStream; import java.io.IOE ...

随机推荐

  1. Ubuntu12.04-64bits搭建FFmpeg环境

    所有的环境搭建动作请参考FFMpeg官方网站:http://www.ffmpeg.org/index.html 1. 获取源代码: git clone git://source.ffmpeg.org/ ...

  2. C语言 处理文件

    刚学习C语言不久,运用C语言处理各种文件.这里列出,处理文件所需的大部分函数,已经整理的笔记,使用的注意事项.

  3. 如何在 CentOS 7 上安装 Redis 服务器

    大家好,本文的主题是 Redis,我们将要在 CentOS 7 上安装它.编译源代码,安装二进制文件,创建.安装文件.在安装了它的组件之后,我们还会配置 redis ,就像配置操作系统参数一样,目标就 ...

  4. Yii 的AR单行数据自动缓存机制

    相关的YII类: CActiveRecord CActiveRecordBehavior cache Active Record Active Record (AR) 是一个流行的 对象-关系映射 ( ...

  5. Javascript数据类型——number类型

            ECMAScript规范中使用IEEE754格式来表示整数和浮点数.支持十进制.八进制以及十六进制.有一点注意的是八进制数字在严格模式下是无效的,这可能会影响到程序的正常运行. 避免浮 ...

  6. 399. Evaluate Division

    图像题,没觉得有什么简单的办法,貌似可以用Union Find来解. 感觉有2种思路,一种是先全部构建好每2个点的weight,然后直接遍历queires[][]来抓取答案. 一种是只构建简单的关系图 ...

  7. servlet中web.xml配置

    常见的Servlet中url-pattren的配置 1.固定配置, 如:/hi 引入通配符 * 2.以"/XXX"开头,以"*"结尾 3.以"*&qu ...

  8. Excel文件上传

    *&---------------------------------------------------------------------* *& FORM FRM_UPDATA_ ...

  9. At-rule | CSS @ 规则

    译自:MDN(Mozilla开发者网络) At-rule 一.什么是at-rules eg:@charset "utf-8"; at-rule 是CSS样式声明,以@开头,紧跟着是 ...

  10. uva 167 - The Sultan&#39;s Successors(典型的八皇后问题)

    这道题是典型的八皇后问题,刘汝佳书上有具体的解说. 代码的实现例如以下: #include <stdio.h> #include <string.h> #include < ...