XmlReader.ReadElementContentAsObjectAsync 方法


异步读取当前元素并将内容作为 Object 返回。Asynchronously reads the current element and returns the contents as an Object.

 virtual System::Threading::Tasks::Task<System::Object ^> ^ ReadElementContentAsObjectAsync();
public virtual System.Threading.Tasks.Task<object> ReadElementContentAsObjectAsync ();
abstract member ReadElementContentAsObjectAsync : unit -> System.Threading.Tasks.Task<obj>
override this.ReadElementContentAsObjectAsync : unit -> System.Threading.Tasks.Task<obj>
Public Overridable Function ReadElementContentAsObjectAsync () As Task(Of Object)



一个最适当类型的装箱的公共语言运行时 (CLR) 对象。A boxed common language runtime (CLR) object of the most appropriate type. ValueType 属性确定了适当的 CLR 类型。The ValueType property determines the appropriate CLR type. 如果将内容类型化为列表类型,则此方法返回一个适当类型的装箱对象的数组。If the content is typed as a list type, this method returns an array of boxed objects of the appropriate type.


在上一次异步操作完成之前调用了 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 标志设置为 trueAn 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."


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