共用方式為


XmlReaderSettings.IgnoreComments 屬性

定義

取得或設定值,指出是否忽略註解。

public:
 property bool IgnoreComments { bool get(); void set(bool value); };
public bool IgnoreComments { get; set; }
member this.IgnoreComments : bool with get, set
Public Property IgnoreComments As Boolean

屬性值

Boolean

true 表示忽略註解,否則為 false。 預設為 false

範例

下列會建立可用來建構讀取器的設定物件,該讀取器會去除處理指示、批註和不重要的空白字元。

// Set the reader settings.
XmlReaderSettings^ settings = gcnew XmlReaderSettings;
settings->IgnoreComments = true;
settings->IgnoreProcessingInstructions = true;
settings->IgnoreWhitespace = true;
// Set the reader settings.
XmlReaderSettings settings = new XmlReaderSettings();
settings.IgnoreComments = true;
settings.IgnoreProcessingInstructions = true;
settings.IgnoreWhitespace = true;
' Set the reader settings.
Dim settings as XmlReaderSettings = new XmlReaderSettings()
settings.IgnoreComments = true
settings.IgnoreProcessingInstructions = true
settings.IgnoreWhitespace = true

備註

將此屬性設定為 true 可能會導致讀取器傳回多個連續文位元組點。 這不會影響驗證。

適用於

另請參閱