The definition of the XPathResultType
enumeration in the .NET framework gives the same value (1) to "String" as it does to "Navigator". Surely that can't be right? What gives?
I'm implementing some custom XPath function, and I'm trying to write a single method to validate the arguments of my functions based on the declared XPathResultType of each argument. However, I'm stumped as to how I'm supposed to cater for this overlap...
#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,
}
}
There is a closed issue on Microsoft Connect: https://connect.microsoft.com/VisualStudio/feedback/details/97578/both-xpathresulttype-string-and-xpathresulttype-navigator-are-1
Answer from Microsoft: