.NET 框架中 XPathResultType
枚举的定义为“String”提供了与“Navigator”相同的值 (1)。这肯定是不对的吧?给出了什么?
我正在实现一些自定义 XPath 函数,并且我正在尝试编写一个方法来根据每个参数声明的 XPathResultType 来验证函数的参数。然而,我对如何应对这种重叠感到困惑......
#region Assembly System.Xml.dll, v4.0.30319
// C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Xml.dll
#endregion
using System;
namespace System.Xml.XPath
{
// Summary:
// Specifies the return type of the XPath expression.
public enum XPathResultType
{
// Summary:
// A numeric value.
Number = 0,
//
// Summary:
// A System.String value.
String = 1,
//
// Summary:
// A tree fragment.
Navigator = 1,
//
// Summary:
// A System.Booleantrue or false value.
Boolean = 2,
//
// Summary:
// A node collection.
NodeSet = 3,
//
// Summary:
// Any of the XPath node types.
Any = 5,
//
// Summary:
// The expression does not evaluate to the correct XPath type.
Error = 6,
}
}
最佳答案
Microsoft Connect 上有一个已解决的问题:https://connect.microsoft.com/VisualStudio/feedback/details/97578/both-xpathresulttype-string-and-xpathresulttype-navigator-are-1
微软的答复:
The overlapping enum values is a known issue. The workaround is to never use the
XPathResultType.Navigator
value and to always useXPathResultType.NodeSet
.
关于c# - XPathResultType 定义错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9132649/