XmlWriter.WriteElementStringAsync(String, String, String, String) 方法
定义
异步写入具有指定的前缀、本地名称、命名空间 URI 和值的元素。Asynchronously writes an element with the specified prefix, local name, namespace URI, and value.
public:
System::Threading::Tasks::Task ^ WriteElementStringAsync(System::String ^ prefix, System::String ^ localName, System::String ^ ns, System::String ^ value);
public System.Threading.Tasks.Task WriteElementStringAsync (string prefix, string localName, string ns, string value);
public System.Threading.Tasks.Task WriteElementStringAsync (string? prefix, string localName, string? ns, string value);
member this.WriteElementStringAsync : string * string * string * string -> System.Threading.Tasks.Task
Public Function WriteElementStringAsync (prefix As String, localName As String, ns As String, value As String) As Task
参数
- prefix
- String
元素的前缀。The prefix of the element.
- localName
- String
元素的本地名称。The local name of the element.
- ns
- String
元素的命名空间 URI。The namespace URI of the element.
- value
- String
元素的值。The value of the element.
返回
表示 WriteElementString 异步操作的任务。The task that represents the asynchronous WriteElementString 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 标志设置为 true。An 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."
注解
这是的异步版本 WriteElementString ,具有相同的功能。This is the asynchronous version of WriteElementString, with the same functionality. 若要使用此方法,必须将 Async 标志设置为 true 。To use this method, you must set the Async flag to true.