choice for collections of objects in a Windows Application development project

I am a college student trying to build a small windows application using Visual Studio 2005.

Business Context:

Simulation of a computer science department that contains faculty, students, courses, advisors etc.

My question:

1) Some of the entities will obviously be the ones mentioned above. When I built the class diagram, I felt a good design choice would be that a department class would contain collections of faculty, courses advisors, degree programs etc.

What do you think will be the best collection type to capture these objects or collections of objects such as ArrayList or List ? Can you capture them as Faculty[], advisor[] etc.? If yes, how?

Thanks.
scarface7Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PoeticAudioCommented:
An ArrayList is good because it's easy to use, plus it can hold any object, as long as you cast it back.

ArrayList al = new ArrayList();

//it's easy to add objects to an ArrayList!
MyObject myObject = new MyObject();
al.Add(myObject);


//it's also easy to cast back to MyObject.
foreach(MyObject myObj in al)
{
   myObj.MyMethod();
}

//or if you want to use an index, say you added 3 of MyObjects to the ArrayList and
//you wanted to call the 2nd one in the list

MyObject myObject = (MyObject)al[1];  //ArrayList is 0 based
myObject.MyMethod();

or

//here we use as to cast the 2nd entry in the ArrayList to a MyObject type and then call MyMethod
(al[1] as MyObject).MyMethod();
0
balajikumar75Commented:
A hastable is faster in access and in addition it gives you a key value pair where value could be a object. So retrival is based onn they key name and not list of no's as in arraylist.

I would recommend you to use a hashtable.
0
GENTPCommented:
use the CollectionBase

ie:

using System.Collection;


public class Faculty
{

}

public class Deptment : CollectionBase
{
 void AddFaculty(Faculty newFaculty)
{
List.Insert(newFaculty);
}

This will give you stronged typed collection. Here's a link that will provide you with more details

http://www.codeproject.com/csharp/collection1.asp

}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.