C# for循环创建数组

#region 获取数组
//将dt stockid字段数据传进list
List<int> liststock = new List<int>();
for (int i = 0; i < dtStock.Rows.Count; i++)
{
    liststock.Add(int.Parse(dtStock.Rows[i]["FSTOCKID"].ToString()));
}
List<int> listNew = new List<int>();
//删除重复数据
foreach (int eachString in liststock)
{
    if (!listNew.Contains(eachString))
        listNew.Add(eachString);
}
//赋值给数组
int[] stockID = listNew.ToArray();
#endregion

上一篇:给Ant degin中Calendar渲染当前月份日期标记


下一篇:oracle