XmlReader.ReadContentAsStringAsync 方法
定义
public:
virtual System::Threading::Tasks::Task<System::String ^> ^ ReadContentAsStringAsync();
public virtual System.Threading.Tasks.Task<string> ReadContentAsStringAsync ();
abstract member ReadContentAsStringAsync : unit -> System.Threading.Tasks.Task<string>
override this.ReadContentAsStringAsync : unit -> System.Threading.Tasks.Task<string>
Public Overridable Function ReadContentAsStringAsync () As Task(Of String)
返回
作为 String 对象的文本内容。The text content as a String object.
例外
在上一次异步操作完成之前调用了 XmlReader 方法。An XmlReader 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-
调用了 XmlReader 异步方法,但未将 Async 标志设置为 true
。An XmlReader asynchronous method was called without setting the Async flag to true
. 在此情况下,将引发 InvalidOperationException 并显示消息“若要使用 Async 方法,请将 XmlReaderSettings.Async 设置为 True。”In this case, InvalidOperationException is thrown with the message "Set XmlReaderSettings.Async to true if you want to use Async Methods."
注解
这是的异步版本 ReadContentAsString ,具有相同的功能。This is the asynchronous version of ReadContentAsString, with the same functionality. 若要使用此方法,必须将 Async 标志设置为 true
。To use this method, you must set the Async flag to true
.