Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- CustomErrorCollection.cs
- GeometryModel3D.cs
- ApplicationId.cs
- SamlDelegatingWriter.cs
- ScriptControl.cs
- _AutoWebProxyScriptWrapper.cs
- ViewGenerator.cs
- BoundConstants.cs
- PrePrepareMethodAttribute.cs
- Transform.cs
- RtfControls.cs
- HtmlMeta.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- PassportAuthenticationEventArgs.cs
- UpdateManifestForBrowserApplication.cs
- DirectoryInfo.cs
- OutOfProcStateClientManager.cs
- UpdateCommand.cs
- InkCanvasInnerCanvas.cs
- BatchParser.cs
- ByteConverter.cs
- SqlDataSourceCommandEventArgs.cs
- ListCardsInFileRequest.cs
- WhiteSpaceTrimStringConverter.cs
- TypeConverterHelper.cs
- ToolBarDesigner.cs
- EventDescriptor.cs
- DbSourceCommand.cs
- _NestedSingleAsyncResult.cs
- GACMembershipCondition.cs
- IndexerNameAttribute.cs
- SynchronizationLockException.cs
- HttpRawResponse.cs
- OutputCacheModule.cs
- TypeDefinition.cs
- DataListGeneralPage.cs
- DependencyObjectPropertyDescriptor.cs
- ConfigPathUtility.cs
- TemplateControlCodeDomTreeGenerator.cs
- ArraySubsetEnumerator.cs
- WorkflowViewService.cs
- ColorTransform.cs
- Symbol.cs
- SelectionWordBreaker.cs
- MatrixConverter.cs
- ImageKeyConverter.cs
- WebRequestModulesSection.cs
- BmpBitmapDecoder.cs
- Avt.cs
- Int64Storage.cs
- PermissionSetEnumerator.cs
- XmlTypeMapping.cs
- ConstraintConverter.cs
- HttpValueCollection.cs
- ConsoleCancelEventArgs.cs
- MessageTraceRecord.cs
- VectorKeyFrameCollection.cs
- XmlSchemaCompilationSettings.cs
- ControlEvent.cs
- LogReserveAndAppendState.cs
- Automation.cs
- TemplateXamlTreeBuilder.cs
- HuffModule.cs
- ViewStateModeByIdAttribute.cs
- SqlDataSourceCommandParser.cs
- TabControl.cs
- OperatorExpressions.cs
- DefaultObjectMappingItemCollection.cs
- EventLogPermission.cs
- QueryStringParameter.cs
- XmlCompatibilityReader.cs
- StringAnimationUsingKeyFrames.cs
- WSDualHttpBindingElement.cs
- precedingsibling.cs
- WorkflowTransactionOptions.cs
- ShapingEngine.cs
- WindowsListBox.cs
- ProfilePropertySettingsCollection.cs
- XmlRootAttribute.cs
- UIElement.cs
- WebPartChrome.cs
- SafeArrayTypeMismatchException.cs
- PlatformCulture.cs
- SecureUICommand.cs
- CoreChannel.cs
- bindurihelper.cs
- DrawingContextDrawingContextWalker.cs
- TitleStyle.cs
- GlobalProxySelection.cs
- HostAdapter.cs
- Type.cs
- SeparatorAutomationPeer.cs
- ModuleBuilderData.cs
- CmsUtils.cs
- MessageLoggingElement.cs
- LinkClickEvent.cs
- PeerNameResolver.cs
- StoreContentChangedEventArgs.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ToolboxItemLoader.cs