XmlWriter.WriteNodeAsync XmlWriter.WriteNodeAsync XmlWriter.WriteNodeAsync XmlWriter.WriteNodeAsync Method

定義

以非同步的方式將來源物件中的每個項目複製到目前的寫入器執行個體。Asynchronously copies everything from the source object to the current writer instance.

多載

WriteNodeAsync(XPathNavigator, Boolean) WriteNodeAsync(XPathNavigator, Boolean) WriteNodeAsync(XPathNavigator, Boolean) WriteNodeAsync(XPathNavigator, Boolean)

以非同步方式將所有項目從 XPathNavigator 物件複製到寫入器。Asynchronously copies everything from the XPathNavigator object to the writer. XPathNavigator 的位置保持不變。The position of the XPathNavigator remains unchanged.

WriteNodeAsync(XmlReader, Boolean) WriteNodeAsync(XmlReader, Boolean) WriteNodeAsync(XmlReader, Boolean) WriteNodeAsync(XmlReader, Boolean)

以非同步的方式從讀取器複製所有內容至寫入器,並將讀取器移至下一個同層級 (Sibling) 的開頭。Asynchronously copies everything from the reader to the writer and moves the reader to the start of the next sibling.

備註

這是非同步的WriteNode,使用相同的功能。This is the asynchronous version of WriteNode, with the same functionality. 若要使用此方法,您必須設定Async旗標設為trueTo use this method, you must set the Async flag to true.

WriteNodeAsync(XPathNavigator, Boolean) WriteNodeAsync(XPathNavigator, Boolean) WriteNodeAsync(XPathNavigator, Boolean) WriteNodeAsync(XPathNavigator, Boolean)

以非同步方式將所有項目從 XPathNavigator 物件複製到寫入器。Asynchronously copies everything from the XPathNavigator object to the writer. XPathNavigator 的位置保持不變。The position of the XPathNavigator remains unchanged.

public:
 virtual System::Threading::Tasks::Task ^ WriteNodeAsync(System::Xml::XPath::XPathNavigator ^ navigator, bool defattr);
public virtual System.Threading.Tasks.Task WriteNodeAsync (System.Xml.XPath.XPathNavigator navigator, bool defattr);
abstract member WriteNodeAsync : System.Xml.XPath.XPathNavigator * bool -> System.Threading.Tasks.Task
override this.WriteNodeAsync : System.Xml.XPath.XPathNavigator * bool -> System.Threading.Tasks.Task
Public Overridable Function WriteNodeAsync (navigator As XPathNavigator, defattr As Boolean) As Task

參數

navigator
XPathNavigator XPathNavigator XPathNavigator XPathNavigator

要複製的來源 XPathNavigatorThe XPathNavigator to copy from.

defattr
Boolean Boolean Boolean Boolean

true 表示複製預設屬性,否則為 falsetrue to copy the default attributes; otherwise, false.

傳回

表示非同步 WriteNode 作業的工作。The task that represents the asynchronous WriteNode operation.

例外狀況

在先前的非同步作業完成前呼叫了 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."

-或--or-

在未將 Async 旗標設為 true的情況下呼叫了 XmlWriter 非同步方法。An XmlWriter asynchronous method was called without setting the Async flag to true. 在此情況下,就會擲回 InvalidOperationException 並顯示訊息「如果您要使用非同步方法,請將 XmlWriterSettings.Async 設為 true」。In this case, InvalidOperationException is thrown with the message "Set XmlWriterSettings.Async to true if you want to use Async Methods."

備註

這是非同步的WriteNode,使用相同的功能。This is the asynchronous version of WriteNode, with the same functionality. 若要使用此方法,您必須設定Async旗標設為trueTo use this method, you must set the Async flag to true.

另請參閱

WriteNodeAsync(XmlReader, Boolean) WriteNodeAsync(XmlReader, Boolean) WriteNodeAsync(XmlReader, Boolean) WriteNodeAsync(XmlReader, Boolean)

以非同步的方式從讀取器複製所有內容至寫入器,並將讀取器移至下一個同層級 (Sibling) 的開頭。Asynchronously copies everything from the reader to the writer and moves the reader to the start of the next sibling.

public:
 virtual System::Threading::Tasks::Task ^ WriteNodeAsync(System::Xml::XmlReader ^ reader, bool defattr);
public virtual System.Threading.Tasks.Task WriteNodeAsync (System.Xml.XmlReader reader, bool defattr);
abstract member WriteNodeAsync : System.Xml.XmlReader * bool -> System.Threading.Tasks.Task
override this.WriteNodeAsync : System.Xml.XmlReader * bool -> System.Threading.Tasks.Task
Public Overridable Function WriteNodeAsync (reader As XmlReader, defattr As Boolean) As Task

參數

reader
XmlReader XmlReader XmlReader XmlReader

要從其中讀取的 XmlReaderThe XmlReader to read from.

defattr
Boolean Boolean Boolean Boolean

若要從 true 複製預設屬性,則為 XmlReader,否則為 falsetrue to copy the default attributes from the XmlReader; otherwise, false.

傳回

表示非同步 WriteNode 作業的工作。The task that represents the asynchronous WriteNode operation.

例外狀況

在先前的非同步作業完成前呼叫了 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."

-或--or-

在未將 Async 旗標設為 true的情況下呼叫了 XmlWriter 非同步方法。An XmlWriter asynchronous method was called without setting the Async flag to true. 在此情況下,就會擲回 InvalidOperationException 並顯示訊息「如果您要使用非同步方法,請將 XmlWriterSettings.Async 設為 true」。In this case, InvalidOperationException is thrown with the message "Set XmlWriterSettings.Async to true if you want to use Async Methods."

備註

這是非同步的WriteNode,使用相同的功能。This is the asynchronous version of WriteNode, with the same functionality. 若要使用此方法,您必須設定Async旗標設為trueTo use this method, you must set the Async flag to true.

另請參閱

適用於