Bonjour,

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    /**
    * Salon
    */
    public class CSalon
    {
        public void addRangee(CRangee rangee)
        {
            //....
        }
 
        [XmlArrayItem(typeof(CRangee), ElementName = "rangee")]
        public CRangee []rangees; //référence vers les rangées du salon
    }
 
    /**
    * Liste des salons
    */
    public class CSalonManager
    {
        public static void save()
        {
            TextWriter w = new StreamWriter("save.xml");
            XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(CSalonManager));
            CSalonManager lesSalons = new CSalonManager();
            x.Serialize(w, lesSalons);
            w.Close();
        }
 
        [XmlArrayItem(typeof(CSalon), ElementName = "lesSalons")]
        public static CSalon[] salons;
    }
}
Pourquoi quand je fait CSalonManager.save(), je me retrouve avec un fichier xml ne contenant que ceci:
<?xml version="1.0" encoding="utf-8"?>
<CSalonManager xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xmlnssd="http://www.w3.org/2001/XMLSchema" />
Merci d'avance...