XmlWriter.WriteEndAttribute XmlWriter.WriteEndAttribute XmlWriter.WriteEndAttribute XmlWriter.WriteEndAttribute Method

定義

在衍生類別中覆寫時,會關閉先前的 WriteStartAttribute(String, String) 呼叫。When overridden in a derived class, closes the previous WriteStartAttribute(String, String) call.

public:
 abstract void WriteEndAttribute();
public abstract void WriteEndAttribute ();
abstract member WriteEndAttribute : unit -> unit
Public MustOverride Sub WriteEndAttribute ()

例外狀況

在先前的非同步作業完成前呼叫了 XmlWriter 方法。An XmlWriter method was called before a previous asynchronous operation finished. 在此情況下,會擲回 InvalidOperationException 與「非同步作業已經在進行中」的訊息。In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

備註

如果您呼叫WriteStartAttribute,您可以關閉使用此方法的屬性。If you call WriteStartAttribute, you can close the attribute with this method.

您也可以藉由呼叫來關閉屬性WriteStartAttribute同樣地,呼叫WriteAttributeString,或呼叫WriteEndElementYou can also close the attribute by calling WriteStartAttribute again, calling WriteAttributeString, or calling WriteEndElement.

注意

當您使用XmlWriter將不會寫入至輸出 XML 中,項目和屬性的方法,直到您呼叫Close方法。When you use the XmlWriter methods to output XML, the elements and attributes will not be written until you call the Close method. 例如,如果您用來填入 XmlWriter XmlDocument,除非您關閉XmlWriter,不能觀察目標文件中的屬性與寫入的項目。For example, if you are using the XmlWriter to populate an XmlDocument, until you close the XmlWriter, you will not be able to observe the written elements and attributes in the target document.

這個方法的非同步版本,請參閱WriteEndAttributeAsyncFor the asynchronous version of this method, see WriteEndAttributeAsync.

適用於