XmlReader.ValueType XmlReader.ValueType XmlReader.ValueType XmlReader.ValueType Property

定义

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

public:
 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:intValueTypeSystem.Int32默认情况下。An 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.

适用于