Code Snippet 1
public class CustomerInfoCol lection : IList
{
private ArrayList m_alCustomerInf o;
private DataSet m_ds;
public CustomerInfoCol lection()
{
m_alCustomerInf o = new ArrayList();
}
public void GetAllCustomers ()
{
// Instantiate a Data Layer class to fill the DataSet
// The specific method will fill a DataTable named "Customers"
// See Part 3 for further details.
DCustomers cust = new DCustomers();
m_ds = cust.SelectAllC ustomers();
// Iterate on all rows and create an Info object per row
foreach (DataRow dr in m_ds.Tables["Customers"].Rows)
m_alCustomerInf o.Add(new CustomerInfo(th is, dr));
}
}
Code Snippet 2
public class CustomerInfo
{
private DataRow m_dr;
private CustomerInfoCol lection m_cic;
public CustomerInfo(Cu stomerInfoColle ction coll, DataRow dr)
{
m_cic = coll;
m_dr = dr;
}
}
These snippets are from an article I'm currently reviewing. I just had a
question about what a certain line of code is doing. The line in question is
as follows:
// Iterate on all rows and create an Info object per row
foreach (DataRow dr in m_ds.Tables["Customers"].Rows)
m_alCustomerInf o.Add(new CustomerInfo(th is, dr));
When instantiating a new CustomerInfo object, it's passing 2 parms:
CustomerInfo(th is, dr)
Does this mean that for each customerinfo object that's added, the object
contains a collection object as well?
thanks,
rodchar
public class CustomerInfoCol lection : IList
{
private ArrayList m_alCustomerInf o;
private DataSet m_ds;
public CustomerInfoCol lection()
{
m_alCustomerInf o = new ArrayList();
}
public void GetAllCustomers ()
{
// Instantiate a Data Layer class to fill the DataSet
// The specific method will fill a DataTable named "Customers"
// See Part 3 for further details.
DCustomers cust = new DCustomers();
m_ds = cust.SelectAllC ustomers();
// Iterate on all rows and create an Info object per row
foreach (DataRow dr in m_ds.Tables["Customers"].Rows)
m_alCustomerInf o.Add(new CustomerInfo(th is, dr));
}
}
Code Snippet 2
public class CustomerInfo
{
private DataRow m_dr;
private CustomerInfoCol lection m_cic;
public CustomerInfo(Cu stomerInfoColle ction coll, DataRow dr)
{
m_cic = coll;
m_dr = dr;
}
}
These snippets are from an article I'm currently reviewing. I just had a
question about what a certain line of code is doing. The line in question is
as follows:
// Iterate on all rows and create an Info object per row
foreach (DataRow dr in m_ds.Tables["Customers"].Rows)
m_alCustomerInf o.Add(new CustomerInfo(th is, dr));
When instantiating a new CustomerInfo object, it's passing 2 parms:
CustomerInfo(th is, dr)
Does this mean that for each customerinfo object that's added, the object
contains a collection object as well?
thanks,
rodchar
Comment