[英]How can i get name of the node only not the namespace
I have this node: . 我有这个节点:。 I am using LINQ query to get this node.
我正在使用LINQ查询来获取此节点。 How can i get this node but not the namespace?
我如何获得此节点,但不能获得名称空间? I tried using:
我尝试使用:
foreach(var g in xDoc.Descendants(ab + "games"){
g.Name.ToString();
}
This gives ab(whole namespace string) also with the name. 这也给ab(整个名称空间字符串)加上名称。 Is there a easier way to remove this?
有没有更简单的方法来删除此?
You can do it using the LocalName property: 您可以使用LocalName属性来实现:
foreach(var g in xDoc.Descendants(ab + "games"){
g.Name.LocalName;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.