XElement.LoadAsync 方法

定义

重载

LoadAsync(Stream, LoadOptions, CancellationToken)

以异步方式创建新的 XElement 并使用指定的流初始化其基础 XML 树,可以选择保留空格。Asynchronously creates a new XElement and initializes its underlying XML tree using the specified stream, optionally preserving white space.

LoadAsync(TextReader, LoadOptions, CancellationToken)

以异步方式创建新的 XElement 并使用指定的文本读取器初始化其基础 XML 树,可以选择保留空格。Asynchronously creates a new XElement and initializes its underlying XML tree using the specified text reader, optionally preserving white space.

LoadAsync(XmlReader, LoadOptions, CancellationToken)

以异步方式创建新的 XElement 并使用指定的 XML 文本读取器初始化其基础 XML 树,可以选择保留空格。Asynchronously creates a new XElement and initializes its underlying XML tree using the specified XML reader, optionally preserving white space.

LoadAsync(Stream, LoadOptions, CancellationToken)

以异步方式创建新的 XElement 并使用指定的流初始化其基础 XML 树,可以选择保留空格。Asynchronously creates a new XElement and initializes its underlying XML tree using the specified stream, optionally preserving white space.

public:
 static System::Threading::Tasks::Task<System::Xml::Linq::XElement ^> ^ LoadAsync(System::IO::Stream ^ stream, System::Xml::Linq::LoadOptions options, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Xml.Linq.XElement> LoadAsync (System.IO.Stream stream, System.Xml.Linq.LoadOptions options, System.Threading.CancellationToken cancellationToken);
static member LoadAsync : System.IO.Stream * System.Xml.Linq.LoadOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Xml.Linq.XElement>

参数

stream
Stream

包含要读取的原始 XML 的流。The stream containing the raw XML to read.

options
LoadOptions

枚举值的按位组合,这些枚举值指定用于分析 XML 的加载选项。A bitwise combination of the enumeration values that specify the load options to parse the XML.

cancellationToken
CancellationToken

可用于请求异步操作取消的标志。A token that can be used to request cancellation of the asynchronous operation.

返回

包含指定流的内容的新 XElementA new XElement containing the contents of the specified stream.

注解

如果 options 设置为 PreserveWhitespace,则 IgnoreWhitespace 属性设置为 falseIf options is set to PreserveWhitespace, then the IgnoreWhitespace property is set to false.

LoadAsync(TextReader, LoadOptions, CancellationToken)

以异步方式创建新的 XElement 并使用指定的文本读取器初始化其基础 XML 树,可以选择保留空格。Asynchronously creates a new XElement and initializes its underlying XML tree using the specified text reader, optionally preserving white space.

public:
 static System::Threading::Tasks::Task<System::Xml::Linq::XElement ^> ^ LoadAsync(System::IO::TextReader ^ textReader, System::Xml::Linq::LoadOptions options, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Xml.Linq.XElement> LoadAsync (System.IO.TextReader textReader, System.Xml.Linq.LoadOptions options, System.Threading.CancellationToken cancellationToken);
static member LoadAsync : System.IO.TextReader * System.Xml.Linq.LoadOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Xml.Linq.XElement>

参数

textReader
TextReader

包含要读取的原始 XML 的读取器。A reader containing the raw XML to read.

options
LoadOptions

枚举值的按位组合,这些枚举值指定用于分析 XML 的加载选项。A bitwise combination of the enumeration values that specify the load options to parse the XML.

cancellationToken
CancellationToken

可用于请求异步操作取消的标志。A token that can be used to request cancellation of the asynchronous operation.

返回

包含指定读取器的内容的新 XElementA new XElement containing the contents of the specified reader.

注解

如果 options 设置为 PreserveWhitespace,则 IgnoreWhitespace 属性设置为 falseIf options is set to PreserveWhitespace, then the IgnoreWhitespace property is set to false.

LoadAsync(XmlReader, LoadOptions, CancellationToken)

以异步方式创建新的 XElement 并使用指定的 XML 文本读取器初始化其基础 XML 树,可以选择保留空格。Asynchronously creates a new XElement and initializes its underlying XML tree using the specified XML reader, optionally preserving white space.

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

参数

reader
XmlReader

包含要读取的 XML 的读取器。A reader containing the XML to be read.

options
LoadOptions

枚举值的按位组合,这些枚举值指定用于分析 XML 的加载选项。A bitwise combination of the enumeration values that specify the load options to parse the XML.

cancellationToken
CancellationToken

可用于请求异步操作取消的标志。A token that can be used to request cancellation of the asynchronous operation.

返回

包含指定读取器的内容的新 XElementA new XElement containing the contents of the specified reader.

适用于