class Order
{
public string orderId;
public string orderName;
public decimal orderPrice;
}
public class ConvertToArrayList
{
//方法一
public ArrayList ArrayToArrayList(Order[] orders)
{
ArrayList al = ArrayList.Adapter(orders);
return al;
}
//方法二
public ArrayList ArrayToArrayList2(Order[] orders)
{
ArrayList al = new ArrayList();
foreach (Order or in orders)
{
al.Add(or);
}
return al;
}
public Array ArrayListToArray(ArrayList al)
{
Order[] order = (Order[])al.ToArray(typeof(Order));
return order;
}
}