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

  • 相关阅读:
    Flare3D游戏特效教程:火拳阿宝
    AS3:物体的运动
    Away3D基础教程(三):三维世界的灯光
    代码库工具:SVN
    磨刀不误砍柴工:取巧而已
    可视化组件:Swing JComponent
    软件简单升级方式:文件覆盖
    代码库工具:CVS
    多字符串查找算法:kmp与step
    格式化文本支持:JTextPane
  • 原文地址:https://www.cnblogs.com/upshania/p/3836325.html
Copyright © 2020-2023  润新知