Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Xml / System / Xml / XPath / XPathNavigatorKeyComparer.cs / 1 / XPathNavigatorKeyComparer.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
using System.IO;
using System.Xml.Schema;
using System.Collections;
using System.Diagnostics;
using MS.Internal.Xml.Cache;
namespace System.Xml.XPath {
internal class XPathNavigatorKeyComparer : IEqualityComparer {
bool IEqualityComparer.Equals( Object obj1, Object obj2 ) {
XPathNavigator nav1 = obj1 as XPathNavigator;
XPathNavigator nav2 = obj2 as XPathNavigator;
if( ( nav1 != null ) && ( nav2 != null ) ) {
if( nav1.IsSamePosition( nav2 ) )
return true;
}
return false;
}
int IEqualityComparer.GetHashCode ( Object obj ) {
int hashCode;
XPathNavigator nav;
XPathDocumentNavigator xpdocNav;
if (obj == null) {
throw new ArgumentNullException("obj");
}
else if ( null != (xpdocNav = obj as XPathDocumentNavigator) ) {
hashCode = xpdocNav.GetPositionHashCode();
}
else if( null != (nav = obj as XPathNavigator) ) {
Object underlyingObject = nav.UnderlyingObject;
if (underlyingObject != null) {
hashCode = underlyingObject.GetHashCode();
}
else {
hashCode = (int)nav.NodeType;
hashCode ^= nav.LocalName.GetHashCode();
hashCode ^= nav.Prefix.GetHashCode();
hashCode ^= nav.NamespaceURI.GetHashCode();
}
}
else {
hashCode = obj.GetHashCode();
}
return hashCode;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
using System.IO;
using System.Xml.Schema;
using System.Collections;
using System.Diagnostics;
using MS.Internal.Xml.Cache;
namespace System.Xml.XPath {
internal class XPathNavigatorKeyComparer : IEqualityComparer {
bool IEqualityComparer.Equals( Object obj1, Object obj2 ) {
XPathNavigator nav1 = obj1 as XPathNavigator;
XPathNavigator nav2 = obj2 as XPathNavigator;
if( ( nav1 != null ) && ( nav2 != null ) ) {
if( nav1.IsSamePosition( nav2 ) )
return true;
}
return false;
}
int IEqualityComparer.GetHashCode ( Object obj ) {
int hashCode;
XPathNavigator nav;
XPathDocumentNavigator xpdocNav;
if (obj == null) {
throw new ArgumentNullException("obj");
}
else if ( null != (xpdocNav = obj as XPathDocumentNavigator) ) {
hashCode = xpdocNav.GetPositionHashCode();
}
else if( null != (nav = obj as XPathNavigator) ) {
Object underlyingObject = nav.UnderlyingObject;
if (underlyingObject != null) {
hashCode = underlyingObject.GetHashCode();
}
else {
hashCode = (int)nav.NodeType;
hashCode ^= nav.LocalName.GetHashCode();
hashCode ^= nav.Prefix.GetHashCode();
hashCode ^= nav.NamespaceURI.GetHashCode();
}
}
else {
hashCode = obj.GetHashCode();
}
return hashCode;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FileSystemEventArgs.cs
- TimerElapsedEvenArgs.cs
- ParallelLoopState.cs
- InvalidDataException.cs
- SqlBulkCopyColumnMappingCollection.cs
- BitmapEffectvisualstate.cs
- __Filters.cs
- Rotation3DAnimationUsingKeyFrames.cs
- XsdDataContractExporter.cs
- NetSectionGroup.cs
- ItemsControlAutomationPeer.cs
- ClientOperation.cs
- StreamGeometry.cs
- AccessibleObject.cs
- SqlDataSourceQueryConverter.cs
- Stackframe.cs
- OutputScopeManager.cs
- XMLDiffLoader.cs
- DerivedKeySecurityToken.cs
- EasingFunctionBase.cs
- ICollection.cs
- TreeViewImageIndexConverter.cs
- PeerInputChannel.cs
- ReceiveActivityDesignerTheme.cs
- InteropEnvironment.cs
- RectangleHotSpot.cs
- FileSecurity.cs
- XmlElementAttribute.cs
- ArrayEditor.cs
- StartUpEventArgs.cs
- PriorityQueue.cs
- BitmapVisualManager.cs
- DecoderNLS.cs
- WS2007FederationHttpBinding.cs
- ACE.cs
- NavigationFailedEventArgs.cs
- InheritanceContextHelper.cs
- SiteMap.cs
- Win32.cs
- HtmlAnchor.cs
- DBConcurrencyException.cs
- OutputCacheProfileCollection.cs
- AssertFilter.cs
- SafeSecurityHandles.cs
- DataFormats.cs
- Baml2006Reader.cs
- ToolStripInSituService.cs
- MenuRenderer.cs
- ProcessModelSection.cs
- IDictionary.cs
- mediaclock.cs
- UIElement.cs
- EntityDesignerBuildProvider.cs
- Bold.cs
- StyleBamlTreeBuilder.cs
- PlaceHolder.cs
- LinqDataSourceDisposeEventArgs.cs
- CheckPair.cs
- UndoManager.cs
- ProxyAssemblyNotLoadedException.cs
- WebPartDisplayModeEventArgs.cs
- TextEditorCopyPaste.cs
- SerializationAttributes.cs
- ProcessStartInfo.cs
- MdiWindowListItemConverter.cs
- EventTrigger.cs
- InternalConfigRoot.cs
- Schema.cs
- ContentFilePart.cs
- MobileControlsSection.cs
- SqlUserDefinedTypeAttribute.cs
- WebContext.cs
- MethodBuilderInstantiation.cs
- DBCSCodePageEncoding.cs
- ByteStreamGeometryContext.cs
- IDQuery.cs
- Parameter.cs
- PackagePartCollection.cs
- XamlLoadErrorInfo.cs
- LineBreak.cs
- AnnotationDocumentPaginator.cs
- RadialGradientBrush.cs
- SelectorAutomationPeer.cs
- GradientStop.cs
- ObjectStorage.cs
- Environment.cs
- ConfigurationSettings.cs
- DBNull.cs
- StylusSystemGestureEventArgs.cs
- WizardPanel.cs
- MobileControlBuilder.cs
- TreeNodeStyleCollectionEditor.cs
- IDictionary.cs
- Bits.cs
- TextTreeUndoUnit.cs
- LinqToSqlWrapper.cs
- URL.cs
- HttpCookiesSection.cs
- NavigateEvent.cs
- PowerStatus.cs