XmlWriter.WriteStartDocumentAsync 方法

定义

异步写入 XML 声明。Asynchronously writes the XML declaration.

重载

WriteStartDocumentAsync()

异步写入版本为“1.0”的 XML 声明。Asynchronously writes the XML declaration with the version "1.0".

WriteStartDocumentAsync(Boolean)

异步写入版本为“1.0”的 XML 声明和独立的属性。Asynchronously writes the XML declaration with the version "1.0" and the standalone attribute.

注解

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

WriteStartDocumentAsync()

异步写入版本为“1.0”的 XML 声明。Asynchronously writes the XML declaration with the version "1.0".

public:
 virtual System::Threading::Tasks::Task ^ WriteStartDocumentAsync();
public virtual System.Threading.Tasks.Task WriteStartDocumentAsync ();
abstract member WriteStartDocumentAsync : unit -> System.Threading.Tasks.Task
override this.WriteStartDocumentAsync : unit -> System.Threading.Tasks.Task
Public Overridable Function WriteStartDocumentAsync () As Task

返回

Task

表示 WriteStartDocument 异步操作的任务。The task that represents the asynchronous WriteStartDocument operation.

例外

在上一次异步操作完成之前调用了 XmlWriter 方法。An XmlWriter method was called before a previous asynchronous operation finished. 在此情况下,会引发 InvalidOperationException 并显示消息“异步操作已在进行中。”In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

- 或 --or-

调用了 XmlWriter 异步方法,但未将 Async 标志设置为 trueAn XmlWriter asynchronous method was called without setting the Async flag to true. 在这种情况下,将引发 InvalidOperationException 并显示消息“如果要使用异步方法,请将 XmlWriterSettings.Async 设置为 true”。In this case, InvalidOperationException is thrown with the message "Set XmlWriterSettings.Async to true if you want to use Async Methods."

注解

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

适用于

WriteStartDocumentAsync(Boolean)

异步写入版本为“1.0”的 XML 声明和独立的属性。Asynchronously writes the XML declaration with the version "1.0" and the standalone attribute.

public:
 virtual System::Threading::Tasks::Task ^ WriteStartDocumentAsync(bool standalone);
public virtual System.Threading.Tasks.Task WriteStartDocumentAsync (bool standalone);
abstract member WriteStartDocumentAsync : bool -> System.Threading.Tasks.Task
override this.WriteStartDocumentAsync : bool -> System.Threading.Tasks.Task
Public Overridable Function WriteStartDocumentAsync (standalone As Boolean) As Task

参数

standalone
Boolean

如果为 true,则它将写入"standalone=yes";如果为 false,则它将写入"standalone=no"。If true, it writes "standalone=yes"; if false, it writes "standalone=no".

返回

Task

表示 WriteStartDocument 异步操作的任务。The task that represents the asynchronous WriteStartDocument operation.

例外

在上一次异步操作完成之前调用了 XmlWriter 方法。An XmlWriter method was called before a previous asynchronous operation finished. 在此情况下,会引发 InvalidOperationException 并显示消息“异步操作已在进行中。”In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

- 或 --or-

调用了 XmlWriter 异步方法,但未将 Async 标志设置为 trueAn XmlWriter asynchronous method was called without setting the Async flag to true. 在这种情况下,将引发 InvalidOperationException 并显示消息“如果要使用异步方法,请将 XmlWriterSettings.Async 设置为 true”。In this case, InvalidOperationException is thrown with the message "Set XmlWriterSettings.Async to true if you want to use Async Methods."

注解

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

适用于