XmlIgnoreAttribute 构造函数

定义

初始化 XmlIgnoreAttribute 类的新实例。

public:
 XmlIgnoreAttribute();
public XmlIgnoreAttribute ();
Public Sub New ()

示例

The following example shows a class named Group, which contains a field named Comment. 该示例将 XmlIgnoreAttribute 分配给该字段,从而指示 XmlSerializer 在序列化或反序列化类实例时忽略该字段。

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

适用于

另请参阅