private bool ItemEqual(XPathItem item1, XPathItem item2) { bool res; object x = item1.GetTypedValue(); if (x is UntypedAtomic || x is AnyUriValue) { x = x.ToString(); } object y = item2.GetTypedValue(); if (y is UntypedAtomic || y is AnyUriValue) { y = x.ToString(); } if (x is Single && Single.IsNaN((float)x) || x is Double && Double.IsNaN((double)x)) { x = Double.NaN; } if (y is Single && Single.IsNaN((float)y) || y is Double && Double.IsNaN((double)y)) { y = Double.NaN; } if (x.Equals(y)) { return(true); } if (ValueProxy.Eq(x, y, out res) && res) { return(true); } return(false); }