florianlikecs
Messages postés10Date d'inscriptionlundi 2 novembre 2009StatutMembreDernière intervention21 avril 2010
-
21 avril 2010 à 10:51
florianlikecs
Messages postés10Date d'inscriptionlundi 2 novembre 2009StatutMembreDernière intervention21 avril 2010
-
21 avril 2010 à 17:13
Bonjour,
J'ai un problème d'accès à une collection. Je m'explique :
[list]
- Je possède une classe entreprise qui contient une collection de départements.
- Je possède une classe départements qui contient une collection d'employés.
/list
Lorsque j'écris "monentreprise.collectiondepartement[i]." Je ne peux pas accéder à la collection d'employés.
Qu'est ce qui ne va pas ?
Voici un extrait de mon code :
public class entreprise
{
private ArrayList d = new ArrayList();
public ArrayList D
{
get { return d; }
set { d = value; }
}
[...]
public class departement
{
// Attributs privés
private string nomdepartement;
private ArrayList arrayEmploye = new ArrayList();
public ArrayList ArrayEmploye
{
get { return arrayEmploye; }
set { arrayEmploye = value; }
}
[...]
florianlikecs
Messages postés10Date d'inscriptionlundi 2 novembre 2009StatutMembreDernière intervention21 avril 2010 21 avril 2010 à 17:04
Merci pour ces réponses, j'ai testé avec des List :
public class departement
{
// Attributs privés
private string nomdepartement;
private List arrayEmploye = new List();
public List getarrayEmploye()
{
return arrayEmploye;
}
[...]
public class entreprise
{
private List<departement> d = new List<departement>();
public List<departement> getd()
{
return d;
}
[...]
J'écris donc monentreprise.getd().IndexOf(index) pour accéder a un employé d'un département précis mais je ne peux pas accéder à la collection d'employés: