XmlReader.MoveToContentAsync XmlReader.MoveToContentAsync XmlReader.MoveToContentAsync XmlReader.MoveToContentAsync Method


异步检查当前节点是否为内容节点。Asynchronously checks whether the current node is a content node. 如果此节点不是内容节点,则读取器向前跳至下一个内容节点或文件结尾。If the node is not a content node, the reader skips ahead to the next content node or end of file.

 virtual System::Threading::Tasks::Task<System::Xml::XmlNodeType> ^ MoveToContentAsync();
public virtual System.Threading.Tasks.Task<System.Xml.XmlNodeType> MoveToContentAsync ();
abstract member MoveToContentAsync : unit -> System.Threading.Tasks.Task<System.Xml.XmlNodeType>
override this.MoveToContentAsync : unit -> System.Threading.Tasks.Task<System.Xml.XmlNodeType>
Public Overridable Function MoveToContentAsync () As Task(Of XmlNodeType)


此方法找到的当前节点的 NodeType;如果读取器已到达输入流的末尾,则为 XmlNodeType.NoneThe NodeType of the current node found by the method or XmlNodeType.None if the reader has reached the end of the input stream.


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


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