XmlIgnoreAttribute Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the XmlIgnoreAttribute class.
public:
XmlIgnoreAttribute();
public XmlIgnoreAttribute ();
Public Sub New ()
Examples
The following example shows a class named Group
, which contains a field named Comment
. The example assigns the XmlIgnoreAttribute to the field, thereby instructing the XmlSerializer to ignore the field when serializing or deserializing an instance of the class.
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.
[XmlIgnore]
public string Comment;
// The XmlSerializer serializes this field.
public string GroupName;
}
Public Class Group
' the XmlSerializer ignores this field.
<XmlIgnore()> Public Comment As String
' The XmlSerializer serializes this field.
Public GroupName As String
End Class
Applies to
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.