zoukankan      html  css  js  c++  java
  • 对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()+" ");

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

  • 相关阅读:
    ObjecT4:On-line multiple instance learning (MIL)学习
    目标跟踪ObjectT综述介绍
    CV与IP:基础,经典以及最近发展
    PythonGIS可视化—Matplot basemap工具箱
    SciPy和Numpy处理能力
    mwArray与C++接口
    使用QT的一些小Tipster
    C++调用Matlab 注意事项
    Qwt--散点图/函数图
    **PCL:嵌入VTK/QT显示(Code^_^)
  • 原文地址:https://www.cnblogs.com/upshania/p/3836325.html
Copyright © 2011-2022 走看看