Hello,
> XPathExpression xpCountExpr =
> m_vocabulary.Compile("count(//[EMAIL PROTECTED]'label']/[EMAIL
> PROTECTED]'constructor']/d-param)");
> int nrp = (int)m_vocabulary.Evaluate(xpCountExpr);
>
> But that did not work: I got a castexception in the line following on
> the "int npr" assignment. (Other similar pieces of code had the same
> effect).
This is the expected result. Because
1) XPathNavigator.Evaluate() with such XPath those result is
a number is evaluated as to return System.Double, but
2) the return type of XPathNavigator.Evaluate() is System.Object,
that is, the return value is boxed.
3) The code "(int)" means that it is unboxing the result of
"m_vocabulary.Evaluate(...)" to System.Int32, while it is
actually System.Double (unboxing does not automatically
calls subsequent typecast code).
Both typecasting and unboxing have the same syntax in C#.
Atsushi Eno
_______________________________________________
Mono-list maillist - [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list