473,583 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about some snippets in an article

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
Nov 16 '05 #1
4 1088
It contains a "reference" to a collection object (with emphasis on
reference).

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:A3******** *************** ***********@mic rosoft.com...
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

Nov 16 '05 #2
why pass a ref of the collection? i understand of the datarow but not the
collection?

"rodchar" wrote:
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

Nov 16 '05 #3
Good question. From this amount of code, that is something that I cannot
answer. Normally a hierarchical structure will hold a reference to the
parent object, but I do not know why the collection needs to be held.

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:33******** *************** ***********@mic rosoft.com...
why pass a ref of the collection? i understand of the datarow but not the
collection?

"rodchar" wrote:
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

Nov 16 '05 #4
thanks for the help. in case you're curious:
http://www.microsoft.com/belux/nl/ms...tt/ntier2.mspx
Code Snippet 3 & 4 in the article.
rodchar

"Peter Rilling" wrote:
Good question. From this amount of code, that is something that I cannot
answer. Normally a hierarchical structure will hold a reference to the
parent object, but I do not know why the collection needs to be held.

"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:33******** *************** ***********@mic rosoft.com...
why pass a ref of the collection? i understand of the datarow but not the
collection?

"rodchar" wrote:
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


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
5227
by: Aurélien Géron | last post by:
Hi, Does anyone know where I can find a lot of Python code snippets? I searched the Python wiki and Internet but could not find more than five or ten code snippets at a time. I'm looking for a kind of organized list (GUI snippets, database access snippets, I/O snippets, etc.). I find that there's no better way to learn a language than...
7
7180
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local time reaches the set expire-time. But if it is an expire time set on my server in California, and the cookie is put on a computer that is running...
4
3612
by: anonymous | last post by:
Thanks your reply. The article I read is from www.hakin9.org/en/attachments/stackoverflow_en.pdf. And you're right. I don't know it very clearly. And that's why I want to understand it; for it's useful to help me to solve some basic problem which I may not perceive before. I appreciate your help, sincerely.
3
4636
by: Harry J. Smith | last post by:
I added some sounds to my application, but the example in the msdn Library did not work. It had: public static extern bool PlaySound( string szSound, IntPtr hMod, PlaySoundFlags flags ); The file coredll was not found. I changed it to and it now works. What is the best way to handle this? -Harry
2
2004
by: - Steve - | last post by:
I'm working on my asp.net site and I'm wondering what the best way to reuse little snippets of code is? Right now I have a Class in it's own cs file that I call Snippets. Then when I want to use something in there (like for example I have Snippets.Logout()) I do the following. Snippets snips = new Snippets(); snips.LogOut();
5
1730
by: Darrel | last post by:
I thought this warranted a new thread. Yesterday I asked about access relatively static content...is it better to read from the DB, or just grab a text file. It was suggested that I use the DB and look into the Application Cache settings. I found a good article here: http://www.developer.com/net/net/article.php/1477771
14
1221
by: lovecreatesbea... | last post by:
The book `Code complete' mentions similar code snippets as the followings , and talks about their advantages respectively. But I think these code snippets are totally different in logic, and their functionalities are different. They don't have comparabilities. Am I right? /*code 1*/ for (i = 0; i < N; i++){
31
1757
by: Dave S | last post by:
Hi All, I have been given some code to wok on. It relies heavily on the optimiser to run at the correct speed. With this in mind I have been loking through it to see if I can help it out a bit. I have limitied knowledge of how compilers works, but I understand that some constructs optimise easier / better. We are using a variant of gcc...
19
1479
by: mdh | last post by:
Perhaps slightly OT, but related to Declarator form. From A8.5, the declarators have the syntax; declarator: ptr (opt) direct-declarator. At the bottom of the page, it says, amongst other things
0
7896
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7827
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5375
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3820
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3845
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1434
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.