zoukankan      html  css  js  c++  java
  • datatable 添加同一类型的datatable,字典添加数据

     DataTable dt = new DataTable();

    DataTable newDataTable = new DataTable();

    //添加dt中的数据 到 newDataTable 中
    foreach (DataRow dr in dt.Rows)
    {
    newDataTable.Rows.Add(dr.ItemArray);
    }

     Dictionary<string, List<Data>> tabDatas = new Dictionary<string, List<Data>>();

    for (int i = 0; i < datas[0].Count; i++)
    {
    List<Data> data1 = new List<Data>();

    for (int j = 0; j < datas.Count; j++)
    {
    data1.Add(datas[j][i]);
    }
    tabDatas[datas[0][i].Time.ToString()] = data1;  //datas[0][i].Time.ToString()为key ,不重复,当key 重复时,将value值覆盖之前的value,不会报错
    }

  • 相关阅读:
    Spring----Day03
    Spring----Day02
    python
    python
    python
    python
    python
    python
    python
    python
  • 原文地址:https://www.cnblogs.com/lypstudy/p/9210203.html
Copyright © 2011-2022 走看看