Arraylist和其它一维数组的化

Arraylist和其它一维数组的化

ArrayList members = new ArrayList();
object[] values= members.ToArray()
(ClassMember[])values//错误

ClassMember[] values=members.ToArray(typeof(ClassMermber)) as ClassMember[]//真确
 

//把arraylist转化到字符串数组

  ArrayList labarr = new ArrayList();
 string[] labels = labarr.ToArray(typeof(string)) as string[];

你可能感兴趣的:(ArrayList)