XElement.LoadAsync Method

Definition

Overloads

LoadAsync(Stream, LoadOptions, CancellationToken)

Asynchronously creates a new XElement and initializes its underlying XML tree using the specified stream, optionally preserving white space.

LoadAsync(TextReader, LoadOptions, CancellationToken)

Asynchronously creates a new XElement and initializes its underlying XML tree using the specified text reader, optionally preserving white space.

LoadAsync(XmlReader, LoadOptions, CancellationToken)

Asynchronously creates a new XElement and initializes its underlying XML tree using the specified XML reader, optionally preserving white space.

LoadAsync(Stream, LoadOptions, CancellationToken)

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>
Public Shared Function LoadAsync (stream As Stream, options As LoadOptions, cancellationToken As CancellationToken) As Task(Of XElement)

Parameters

stream
Stream

The stream containing the raw XML to read.

options
LoadOptions

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.

Returns

Task<XElement>

A new XElement containing the contents of the specified stream.

Remarks

If options is set to PreserveWhitespace, then the IgnoreWhitespace property is set to false.

LoadAsync(TextReader, LoadOptions, CancellationToken)

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>
Public Shared Function LoadAsync (textReader As TextReader, options As LoadOptions, cancellationToken As CancellationToken) As Task(Of XElement)

Parameters

textReader
TextReader

A reader containing the raw XML to read.

options
LoadOptions

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.

Returns

Task<XElement>

A new XElement containing the contents of the specified reader.

Remarks

If options is set to PreserveWhitespace, then the IgnoreWhitespace property is set to false.

LoadAsync(XmlReader, LoadOptions, CancellationToken)

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>
Public Shared Function LoadAsync (reader As XmlReader, options As LoadOptions, cancellationToken As CancellationToken) As Task(Of XElement)

Parameters

reader
XmlReader

A reader containing the XML to be read.

options
LoadOptions

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.

Returns

Task<XElement>

A new XElement containing the contents of the specified reader.

Applies to