XmlIgnoreAttribute 建構函式

定義

初始化 XmlIgnoreAttribute 類別的新執行個體。

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

範例

下列範例顯示名為 Group 的類別,其中包含名為 的 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

適用於

另請參閱