Hallo zusammen,
ich hab mal wieder ne Fragen. Kann ich ein mit [XmlElement] deklariertes Objekt, beim Serialisieren ignorieren wenn der Wert des Objektes 0 ist??
		                     
             C#-Quelltext
                        C#-Quelltext                    
           	 										| 1:2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
 10:
 11:
 12:
 13:
 14:
 15:
 16:
 17:
 18:
 19:
 20:
 21:
 22:
 23:
 24:
 
 |         [XmlAttribute("Name")]
 public string name;
 [XmlAttribute("Preis")]
 public double preis;
 [XmlElement("Rabatt")]
 public int rabatt;
 
 public Item()
 {
 }
 
 public Item(string name, double preis)
 {
 this.name = name;
 this.preis = preis;
 }
 
 public Item(string name, double preis, int prozent)
 {
 this.name = name;
 this.preis = preis;
 this.rabatt = prozent;
 }
 | 
		
	  
und zwar soll der Rabatt halt nur in der XML angezeigt werden wenn es auch wirklich Rabatt gibt.
Danke schonmal im Vorraus.
Moderiert von  Kha: Topic aus WinForms verschoben am Mi 08.07.2009 um 16:17
Kha: Topic aus WinForms verschoben am Mi 08.07.2009 um 16:17