H
hazz
If this makes sense, I would like to convert an arraylist of objects
returned from foo() into an array of the objects themselves per;
private Customer[] customers;
private int idx = 0;
public CustomerQueueService()
{
customers = new Customer[] ;
customers = foo(); //I want to copy the returned arraylist
of Customer(s) into the array of Customer(s)
}
public ArrayList foo() {
ArrayList arr = new ArrayList();
while (dr.Read())
{
Customer oCust = new Customer();
if (!dr.IsDBNull(0)) { oCust.CustomerId = dr.GetInt32(0);}
if (!dr.IsDBNull(1)) { oCust.OtherId = dr.GetInt32(1);}
arr.Add(oCust);
}
return arr;
}
Thank you,
-hazz
returned from foo() into an array of the objects themselves per;
private Customer[] customers;
private int idx = 0;
public CustomerQueueService()
{
customers = new Customer[] ;
customers = foo(); //I want to copy the returned arraylist
of Customer(s) into the array of Customer(s)
}
public ArrayList foo() {
ArrayList arr = new ArrayList();
while (dr.Read())
{
Customer oCust = new Customer();
if (!dr.IsDBNull(0)) { oCust.CustomerId = dr.GetInt32(0);}
if (!dr.IsDBNull(1)) { oCust.OtherId = dr.GetInt32(1);}
arr.Add(oCust);
}
return arr;
}
Thank you,
-hazz