对N个数组进行操作。先把这N个一维数组合并成一个2为数组;然后进行操作
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为数组;然后进行操作的更多相关文章
- php数组实现根据某个键值将相同键值合并生成新二维数组的方法
$infos = array( array( 'a' => 36, 'b' => 'xa', 'c' => '2015-08-28 00:00:00', 'd' => '201 ...
- 两个list合并成一个list的操作
addAll 添加另一集合里面的元素 add 添加整个集合包括 [] Stream 操作 合并两个lis 出自http://www.it1352.com/963663.html public cl ...
- PHP将两个二维数组合并为一个二维数组的方法
$a = array(0 => Array(id => 66,class_name => math),1 => Array(id => 67,class_name =&g ...
- 从C过渡到C++——换一个视角深入数组[初始化](1)
从C过渡到C++--换一个视角深入数组[初始化](1) 目录 从C过渡到C++--换一个视角深入数组[初始化](1) 数组的初始化 从C入手 作用域 代码块作用域 文件作用域 原型作用域 函数作用域 ...
- 如何用一个for循环打印出一个二维数组
思路分析: 二维数组在内存中默认是按照行存储的,比如一个二维数组{{1,2,3,},{4,5,6}},它在内存中存储的顺序就是1.2.3.4.5.6,也就是说,对于这6个数组元素,按照从0到5给它们编 ...
- PHP方便快捷的将二维数组中元素的某一列值抽离出来作为此二维数组内元素的key
得益于PHP的强大的内置数组函数array_column();array_combine(); 举个小栗子: <?php // 先查询出用户的基本信息 $userArray = [['id' = ...
- LSM树——LSM 将B+树等结构昂贵的随机IO变的更快,而代价就是读操作要处理大量的索引文件(sstable)而不是一个,另外还是一些IO被合并操作消耗。
Basic Compaction 为了保持LSM的读操作相对较快,维护并减少sstable文件的个数是很重要的,所以让我们更深入的看一下合并操作.这个过程有一点儿像一般垃圾回收算法. 当一定数量的ss ...
- 字符串操作函数:JSON.parse()与JSON.stringify()的区别,字符串转数组 str.split(','),数组转字符串String(),以及对象拼接合并Object.assign(),数组拼接合并concat()
1.JSON.parse() 把字符串转化为 json 对象 例如 arr={ , "site":"www.runoob.com" } var obj = J ...
- java 写一个"HelloJavaWorld你好世界"输出到操作系统文件Hello.txt文件中
package com.beiwo.homework; import java.io.File; import java.io.FileOutputStream; import java.io.IOE ...
随机推荐
- Bzoj 1036: [ZJOI2008]树的统计Count 树链剖分,LCT
1036: [ZJOI2008]树的统计Count Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 11102 Solved: 4490[Submit ...
- C随便练练手的题
判断101-200之间有多少个素数,并输出所有素数 #include <stdio.h> int main(){ ; ; ; ){ while(may<cur){ ){ break; ...
- Linux常用命令及vim的使用、vim常用插件(推荐)
看了3篇文章,很好 vim中的区域拷贝 剪切,粘贴: 正常模式,移动光标到剪切的区域开始处,按v,进入可视模式,然后选择区域.按x键,剪切.到指定位置按p粘贴. 撤销按u 恢复按ctrl-r 简明 ...
- (转)在Mac下使用OpenCV, 在Xcode下使用OpenCV (非常基础,详细)
转自:http://blog.sciencenet.cn/home.php?COLLCC=3456986939&COLLCC=3456885714&mod=space&uid= ...
- 使用GSoap开发WebService客户端与服务端
Gsoap 编译工具提供了一个SOAP/XML 关于C/C++ 语言的实现, 从而让C/C++语言开发web服务或客户端程序的工作变得轻松了很多. 用gsoap开发web service的大致思路 我 ...
- [TypeScript] Using Lodash in TypeScript with Typings and SystemJS
One of the most confusing parts of getting started with TypeScript is figuring out how to use all th ...
- 源泉书签,助您管理海量收藏。www.yuanquanshuqian.com,今日更新:多标签功能已实现
源泉书签.助您管理海量收藏.www.yuanquanshuqian.com,今日更新:多标签功能已实现
- android83 Activity的生命周期,启动模式,返回时传递数据
#Android四大组件 * Activity * BroadCastReceiver * Service * ContentProvider #Activity生命周期 * oncreate:Act ...
- Chapter 6 - How to Play Music and Sound Effect
In this chapter, we would add background music to the game and play sound effect when the hero fires ...
- RTB日志分析MR程序设计
到新公司三个月了,上个月做的是Beacon项目,详细的设计思想还没有写文档.这两周开始搞Hadoop,开始阅读相关论文.开始编写MR程序.开始写java,大学时用java较多,工作后就一直在用c/c+ ...