更新时间:2023-01-17 19:57:36
您可以使用临时容器(例如HashSet)并将所有元素添加到其中.最后,将HashSet的数据复制到ArrayList.
干杯..
You can use a temporary container such as HashSet and adding all element to it. Finally copy the data of HashSet to ArrayList.
Cheers..
ArrayList ar = new ArrayList();
for (int h = 0; h<ds1.Tables[0].Rows.Count; h++)
{
if (!ar.Contains(ds1.Tables[0].Rows[h][0].ToString()))
{
ar.Add(Convert.ToString(ds1.Tables[0].Rows[h][0].ToString()));
}
}