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.

Signature
Noble D. Bell
www.noblesoftware.com
Nicholas Paldino [.NET/C# MVP] - 03 Oct 2007 18:15 GMT
Noble,
It's pretty simple. You can do this:
// In your code:
List<NotePage> notebook = new List<NotePage>();
// Add your items.
notebook.Add(new NotePage());
And then pass notebook to your methods.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>I am a little bit confused on the concept of using a List Class. Here is
>what
[quoted text clipped - 9 lines]
>
> Thanks.
Peter Duniho - 03 Oct 2007 18:18 GMT
> I am a little bit confused on the concept of using a List Class. Here is what
> I want to be able to do:
[quoted text clipped - 5 lines]
> 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.
void SomeMethod(List<NotePage> pages)
{
// ...
}
void SomeOtherMethod()
{
List<NotePage> NoteBook = new List<NotePage>();
NotePage page = new NotePage();
NoteBook.Add(page);
SomeMethod(NoteBook);
}
Pete
sloan - 03 Oct 2007 23:54 GMT
You can also do this:
public class Employee
{}
public class EmployeeCollection : List <Employee>
{
}
This will give you instant strong typed collections.....a vast improvement
over 1.1 CollectionBase stuff.
You don't have to do this, you just ~can do this.
List <Employee> allEmployees = new List <Employee>();
works as well.
>I am a little bit confused on the concept of using a List Class. Here is
>what
[quoted text clipped - 9 lines]
>
> Thanks.