XmlReader.XmlLang 属性

定义

当在派生类中被重写时,获取当前的 xml:lang 范围。When overridden in a derived class, gets the current xml:lang scope.

public:
 virtual property System::String ^ XmlLang { System::String ^ get(); };
public:
 abstract property System::String ^ XmlLang { System::String ^ get(); };
public virtual string XmlLang { get; }
public abstract string XmlLang { get; }
member this.XmlLang : string
Public Overridable ReadOnly Property XmlLang As String
Public MustOverride ReadOnly Property XmlLang As String

属性值

String

当前 xml:lang 范围。The current xml:lang scope.

例外

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

示例

XmlTextReader.XmlLang有关使用此属性的示例,请参阅。See XmlTextReader.XmlLang for an example of using this property.

注解

此属性表示 xml:lang 当前节点所在的作用域。This property represents the xml:lang scope within which the current node resides. 例如,以下是 xml:lang 根元素中设置为 US 英语的 XML 片段:For example, here is an XML fragment with xml:lang set to US English in the root element:

<root xml:lang="en-us">   
<name>Fred</name>   
</root>   

当读取器定位在元素上时 name ,可以使用此属性来查找它是否在美国英语特性的作用域中 xml:langWhen the reader is positioned on the name element, you can use this property to find that it is in the scope of a US English xml:lang attribute.

适用于

另请参阅