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
- M3DUtil.cs
- WebServiceTypeData.cs
- WebContext.cs
- Item.cs
- WindowsSlider.cs
- WebPartConnectionsConnectVerb.cs
- SqlProviderManifest.cs
- NavigateEvent.cs
- BinaryMethodMessage.cs
- BinHexEncoder.cs
- CodeConstructor.cs
- Form.cs
- RequestCacheValidator.cs
- BinaryNegotiation.cs
- TreeNode.cs
- DataObjectMethodAttribute.cs
- SerializationSectionGroup.cs
- FloatUtil.cs
- RadioButton.cs
- XPathPatternBuilder.cs
- ParameterReplacerVisitor.cs
- InstanceContextMode.cs
- ComponentDispatcherThread.cs
- XmlAttributeHolder.cs
- ProvidersHelper.cs
- XmlILIndex.cs
- FileDataSourceCache.cs
- ArgumentsParser.cs
- OrderedDictionary.cs
- Shape.cs
- SimplePropertyEntry.cs
- InstanceData.cs
- XPathSelectionIterator.cs
- WSDualHttpSecurity.cs
- DesignTableCollection.cs
- DbConnectionPoolOptions.cs
- ShapeTypeface.cs
- WaitHandleCannotBeOpenedException.cs
- LambdaCompiler.Lambda.cs
- CommandSet.cs
- DataGridRelationshipRow.cs
- HttpRuntimeSection.cs
- HtmlInputText.cs
- PasswordValidationException.cs
- ObjectDataSource.cs
- Brush.cs
- MailHeaderInfo.cs
- SelectedGridItemChangedEvent.cs
- InvokeHandlers.cs
- CodeDirectionExpression.cs
- EmissiveMaterial.cs
- ProtocolsConfiguration.cs
- AuthenticationSection.cs
- WebPartDeleteVerb.cs
- WindowCollection.cs
- XPathAxisIterator.cs
- RepeatButtonAutomationPeer.cs
- OutputScope.cs
- TextAction.cs
- InstanceHandle.cs
- Accessible.cs
- _PooledStream.cs
- MatrixTransform3D.cs
- DataRowCollection.cs
- HtmlButton.cs
- CharStorage.cs
- SmtpException.cs
- EventLogPropertySelector.cs
- StrongNameUtility.cs
- RunInstallerAttribute.cs
- COM2AboutBoxPropertyDescriptor.cs
- DictionaryEditChange.cs
- PrePrepareMethodAttribute.cs
- AsyncPostBackErrorEventArgs.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- Compilation.cs
- ProxyAttribute.cs
- TreeNodeEventArgs.cs
- PartialArray.cs
- ResourceAttributes.cs
- SymbolMethod.cs
- PropertyGrid.cs
- PrintDialogException.cs
- FlowLayoutSettings.cs
- Filter.cs
- EndCreateSecurityTokenRequest.cs
- PropertyPath.cs
- __TransparentProxy.cs
- QuadraticBezierSegment.cs
- formatter.cs
- Themes.cs
- XmlSchemaSet.cs
- LayoutEditorPart.cs
- SecurityKeyUsage.cs
- InheritedPropertyChangedEventArgs.cs
- TableSectionStyle.cs
- SmiSettersStream.cs
- Reference.cs
- ContentValidator.cs
- EntityDesignerUtils.cs