Gets an IEqualityComparer used for equality comparison of XPathNavigator objects.
Imports System
Imports System.Collections
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim document As XPathDocument = New XPathDocument("books.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()
Dim table As Hashtable = New Hashtable(XPathNavigator.NavigatorComparer)
For Each navigator2 As XPathNavigator In navigator.Select("//book")
Dim value As Object = navigator2.Evaluate("string(./title)")
table.Add(navigator2.Clone(), value)
Console.WriteLine("Added book with title {0}", value)
Next
Console.WriteLine(table.Count)
Console.WriteLine(table.Contains(navigator.SelectSingleNode("//book[title='The Confidence Man']")))
End Sub
End Class
Related examples in the same category