zoukankan      html  css  js  c++  java
  • 数组排序

    功能:多个数组,排列,从功以上来说网上该有现成的例子。。。

    找到的全是写得很复杂,自己写了一个。

     List<string> ToDo(string[] arrA, string[] arrB)
            {
    
                List<string> resultList = new List<string>();
                //string[] arrA = { "a", "b" };
                //string[] arrC = { "a", "d" };
                foreach (string str in arrA)
                {
                    foreach (string st in arrB)
                    {
                        resultList.Add(str + st);
                    }
    
                }
                return resultList;
            }
    

      

      public void Test()
            {
                List<string> aa = new List<string> { "a", "b" };
                List<string> bb = new List<string> { "c", "d" };
                List<string> cc = new List<string> { "e", "f", "g" };
                List<List<string>> resultList = new List<List<string>>();
                resultList.Add(aa);
                resultList.Add(bb);
                resultList.Add(cc);
                List<string> result = new List<string>();
                for (int i = 0; i < resultList.Count - 1; i++)
                {
                    if (result.Count == 0)
                    {
                        result = ToDo(resultList[i].ToArray(), resultList[i + 1].ToArray());
                    }
                    else
                    {
                        result = ToDo(result.ToArray(), resultList[i+1].ToArray());
                    }
                }
            }
    

      

    -------长沙程序员技术交流QQ群:428755207-------
  • 相关阅读:
    Nmap笔记
    Spring AOP(一)
    Spring IOC(三)
    Spring IOC(二)
    Spring IOC(一)
    bootstrap 使用(三)
    bootstrap 使用(二)
    bootstrap 使用(一)
    js(二)
    QQ邮件
  • 原文地址:https://www.cnblogs.com/qq4004229/p/2860135.html
Copyright © 2011-2022 走看看