[Mono-list] XPathNavigator.Evaluate casting

Kris Luyten kris.luyten@luc.ac.be
Wed, 17 Sep 2003 10:19:47 +0200


Hi,

I have a small question concerning the XPathNavigator.
The msdn documentation shows the Evaluate method can be casted,
so I used (m_vocabulary is an XPathNavigator):

XPathExpression xpCountExpr =
m_vocabulary.Compile("count(//d-class[@id='label']/d-property[@id='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).
So now I changed the code into:
int nrp = Int32.Parse(m_vocabulary.Evaluate(xpCountExpr).ToString());
and this works correctly.

Is this because of my misunderstanding of the documentation or due to a
bug or unfinished code in mono?

Regards,
Kris
-- 
Kris Luyten
Expertisecentrum Digitale Media - Limburgs Universitair Centrum
Wetenschapspark 2  3590 Diepenbeek (Belgium)
tel.: +32 (0)11 268411
email: kris.luyten@luc.ac.be
PGP-key: http://lumumba.luc.ac.be/kris/kris-pub.txt
homepage: http://lumumba.luc.ac.be/kris/