共用方式為


XmlReader.GetValueAsync 方法

定義

非同步取得目前節點的值。

public:
 virtual System::Threading::Tasks::Task<System::String ^> ^ GetValueAsync();
public virtual System.Threading.Tasks.Task<string> GetValueAsync();
abstract member GetValueAsync : unit -> System.Threading.Tasks.Task<string>
override this.GetValueAsync : unit -> System.Threading.Tasks.Task<string>
Public Overridable Function GetValueAsync () As Task(Of String)

傳回

目前節點的值。

例外狀況

在先前非同步操作結束前,會呼叫一個 XmlReader 方法。 此時, InvalidOperationException 會拋出「非同步操作已進行中」的訊息。

-或-

呼叫非 XmlReader 同步方法時未將 Async 標記設為 true。 此時, InvalidOperationException 會跳出「若你想使用非同步方法,將 XmlReaderSettings.Async 設為 true」的訊息。

備註

使用此方法時,必須將 標記設 Asynctrue

適用於

另請參閱