XElement.LoadAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
- Source:
- XElement.cs
- Source:
- XElement.cs
- Source:
- XElement.cs
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
A new XElement containing the contents of the specified stream.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
If options
is set to PreserveWhitespace, then the IgnoreWhitespace property is set to false
.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Load(Stream, LoadOptions).
Applies to
LoadAsync(TextReader, LoadOptions, CancellationToken)
- Source:
- XElement.cs
- Source:
- XElement.cs
- Source:
- XElement.cs
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
A new XElement containing the contents of the specified reader.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
If options
is set to PreserveWhitespace, then the IgnoreWhitespace property is set to false
.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Load(TextReader, LoadOptions).
Applies to
LoadAsync(XmlReader, LoadOptions, CancellationToken)
- Source:
- XElement.cs
- Source:
- XElement.cs
- Source:
- XElement.cs
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
A new XElement containing the contents of the specified reader.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Load(XmlReader, LoadOptions).
Applies to
Зворотний зв’язок
https://aka.ms/ContentUserFeedback.
Очікується незабаром: протягом 2024 року ми будемо припиняти використання механізму реєстрації проблем у GitHub для зворотного зв’язку щодо вмісту й замінювати його новою системою зворотного зв’язку. Докладніше:Надіслати й переглянути відгук про