c # Remove array has no way to convert List, and then use the Remove method (e.g. arrays a, b, c b removed only ac)

c # Remove array has no way to convert list not be removed, because the list comes Remove method

 string   aaa=a,b,c;

var array=aaa.Split(',');//   数组
List<String> list = array.ToList();//转换为list
for (int i=0;i< list.Count;i++)
{
if (list[i] == "b")
{
list.Remove(list[i]);
}
}
string[] newarray=list.ToArray();

Finally, the array is a c

Guess you like

Origin www.cnblogs.com/tiancaige/p/11426978.html