Freigeben über


XmlIgnoreAttribute-Konstruktor

Initialisiert eine neue Instanz der XmlIgnoreAttribute-Klasse.

Namespace: System.Xml.Serialization
Assembly: System.Xml (in system.xml.dll)

Syntax

'Declaration
Public Sub New
'Usage
Dim instance As New XmlIgnoreAttribute
public XmlIgnoreAttribute ()
public:
XmlIgnoreAttribute ()
public XmlIgnoreAttribute ()
public function XmlIgnoreAttribute ()

Beispiel

Im folgenden Beispiel enthält die Klasse Group das Feld Comment. Im Beispiel wird dem Feld das XmlIgnoreAttribute zugewiesen und XmlSerializer somit angewiesen, das Feld beim Serialisieren bzw. Deserialisieren einer Instanz der Klasse zu ignorieren.

Public Class Group
    ' the XmlSerializer ignores this field.
    <XmlIgnore()> Public Comment As String
    
    ' The XmlSerializer serializes this field.
    Public GroupName As String
End Class
public class Group
{
   // The XmlSerializer ignores this field.
   [XmlIgnore]
   public string Comment;

   // The XmlSerializer serializes this field.
   public string GroupName;
}
   
public ref class Group
{
public:

   // The XmlSerializer ignores this field.

   [XmlIgnore]
   String^ Comment;

   // The XmlSerializer serializes this field.
   String^ GroupName;
};
public class Group
{
    // The XmlSerializer ignores this field.
    /** @attribute XmlIgnore()
     */
    public String comment;
    // The XmlSerializer serializes this field.
    public String groupName;
} //Group

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

XmlIgnoreAttribute-Klasse
XmlIgnoreAttribute-Member
System.Xml.Serialization-Namespace
XmlAttributes.XmlIgnore-Eigenschaft
XmlAttributeOverrides-Klasse
XmlSerializer