.NET框架中XPathResultType
枚举的定义为“字符串”赋予与“导航器”相同的值(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
微软的回答:
重叠的枚举值是一个已知问题。解决方法是
从不使用XPathResultType.Navigator
值,并且始终使用
XPathResultType.NodeSet
。
关于c# - XPathResultType定义错误?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9132649/