Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Class Example? 1

Status
Not open for further replies.

DeanConsulting

Programmer
Jan 11, 2002
131
US
I am a little bit confused on the concept of using a List Class. Here is what I want to be able to do:

1) I create an object called "NotePage"
2) I want to add several "NotePage" objects to a "NoteBook" List
3) I then want to be able to pass a List Class as a parameter to a method call

Can anyone give me some examples on how to do this or at least point me in the right direction? I am about to go nuts here.

Thanks.


---------------------------------------
Noble D. Bell
 
using System.Collections.Generic;

public class NoteBook
{
public List<NotePage> notebookpages = new List<NotePage>();

public void AddNotePage(NotePage page)
{
notebookpages.Add(page);
}

public void AddNotePages(List<NotePage> pages)
{
foreach (NotePage page in pages)
{
notebookpages.Add(page);
}
}

public List<NotePage> GetPages()
{
return notebookpages;
}
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top