XmlReader.ReadOuterXmlAsync 方法

定义

异步读取包含该节点和所有它的子级的内容(包括标记)。Asynchronously reads the content, including markup, representing this node and all its children.

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

返回

Task<String>

如果读取器定位在元素或属性节点上,此方法将返回当前节点及其所有子级的所有 XML 内容(包括标记);否则返回空字符串。If the reader is positioned on an element or an attribute node, this method returns all the XML content, including markup, of the current node and all its children; otherwise, it returns an empty string.

例外

调用了 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."

注解

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

适用于

另请参阅