XNode.ReadFromAsync(XmlReader, CancellationToken) 方法

定義

XNode 建立 XmlReaderCreates an XNode from an XmlReader. 節點的執行階段類型依讀取器中遇到的第一個節點 NodeType 來決定。The runtime type of the node is determined by the NodeType of the first node encountered in the reader.

public:
 static System::Threading::Tasks::Task<System::Xml::Linq::XNode ^> ^ ReadFromAsync(System::Xml::XmlReader ^ reader, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Xml.Linq.XNode> ReadFromAsync (System.Xml.XmlReader reader, System.Threading.CancellationToken cancellationToken);
static member ReadFromAsync : System.Xml.XmlReader * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Xml.Linq.XNode>

參數

reader
XmlReader

位於節點的讀取器,以讀入這個 XNodeA reader positioned at the node to read into this XNode.

cancellationToken
CancellationToken

可用來要求取消非同步作業的權杖。A token that can be used to request cancellation of the asynchronous operation.

傳回

XNode,包含讀取自讀取器的節點。An XNode that contains the nodes read from the reader.

例外狀況

XmlReader 未位於可識別的節點型別上。The XmlReader is not positioned on a recognized node type.

適用於