XmlReader.ReadAsync XmlReader.ReadAsync XmlReader.ReadAsync XmlReader.ReadAsync Method

定义

异步读取该流的下一个节点。Asynchronously reads the next node from the stream.

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

返回

如果成功读取了下一个节点,则为 true;如果没有其他节点可读取,则为 falsetrue if the next node was read successfully; false if there are no more nodes to read.

异常

在上一次异步操作完成之前调用了 XmlReader 方法。An XmlReader 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-

调用了 XmlReader 异步方法,但未将 Async 标志设置为 trueAn XmlReader asynchronous method was called without setting the Async flag to true. 在此情况下,将引发 InvalidOperationException 并显示消息“若要使用 Async 方法,请将 XmlReaderSettings.Async 设置为 True。”In this case, InvalidOperationException is thrown with the message "Set XmlReaderSettings.Async to true if you want to use Async Methods."

注解

这是的异步版本Read,具有相同的功能。This is the asynchronous version of Read, with the same functionality. 若要使用此方法,必须将Async标志设置为。 trueTo use this method, you must set the Async flag to true.

适用于

另请参阅