XmlReader.ValueType 属性


获取当前节点的公共语言运行时 (CLR) 类型。Gets The Common Language Runtime (CLR) type for the current node.

 virtual property Type ^ ValueType { Type ^ get(); };
public virtual Type ValueType { get; }
member this.ValueType : Type
Public Overridable ReadOnly Property ValueType As Type


与节点的类型化值对应的 CLR 类型。The CLR type that corresponds to the typed value of the node. 默认值为 System.StringThe default is System.String.


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


有关默认映射的列表,请参阅System.web 类中的类型支持See Type Support in the System.Xml Classes for a list of the default mappings.

默认情况下,类型 xs:int 的元素具有 System.Int32 ValueTypeAn element of type xs:int has a ValueType of System.Int32 by default. ValueType 可以是可以映射到 xs:int的有效类型之一,如 System.Int16System.DoubleHowever, the ValueType could be one of the valid types that can be mapped to xs:int, such as System.Int16 or System.Double.

如果节点未类型化,或者节点是包含混合内容的元素,则将节点值映射到 System.String 类型。If a node is un-typed, or if the node is an element that contains mixed content, the node value is mapped to the System.String type.


实现程序必须为每个节点提供 ValueType,即使它只是 System.String 类型。Implementers must provide a ValueType for every node, even if it is only the System.String type.