C# : What should I use: Array or ArrayList or List of list?

i'm learning C# and i need some advise.

I'm trying to create users (Active Directory) from an XML file. Those users are students and teachers. For each user i need his name, surname, birthdate to generate his login, password.

  • A student can be only member of one groupe (his class).
  • A teacher can have one or more group (classes where he teaches).

All information i need are in the XML.

In powershell, it works like this :

  • Students : tab[name,surname,birthdate,login,group] (and works also in c#)
  • Teachers : tab[name,surname,birthdate,login,tab[groups]]

How can i do this in C# ? I try with an Array in 3D but it his ugly and not very performant with hundreds of users ... Is there a better way to do this with lists ? ArrayList ?

Sorry for ma bad english ...

Thanks for your help (and pieces of code ^^) !

Example of the XML for the teachers :

--<PERSON ID="6022">
----<TEACHER ID="6022">
----<TEACHER ID="6022">


You might want to take a look at XDocument.

You can create one by calling XDocument.Parse("<myDoc></myDoc>")


var xml = @"<DATA>
<PERSON ID=""6022"">
<TEACHER ID=""6022"">
<TEACHER ID=""6022"">

var doc = XDocument.Parse(xml);

var peopleElements = doc
var q = from person in peopleElements
select new {
    Name = person.Element("NAME").Value,
    BirthDate = person.Element("BIRHDATE").Value

var peopleList = q.ToList();

Need Your Help

Check Database Frequently in android

android database android-service android-calendar

I need to create an android app which save events and reminders in a database. When the correct time comes it should show a notification. For that case I need to create a service to look for events...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.