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.Xml 类中的类型支持See Type Support in the System.Xml Classes for a list of the default mappings.

默认情况下,类型的元素 xs:int 具有 ValueTypeSystem.Int32An 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.