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
- ExpressionParser.cs
- AuthenticationManager.cs
- BindingManagerDataErrorEventArgs.cs
- NoResizeSelectionBorderGlyph.cs
- ScrollProperties.cs
- MatrixAnimationUsingKeyFrames.cs
- RecordsAffectedEventArgs.cs
- XPathDocument.cs
- FieldNameLookup.cs
- StyleReferenceConverter.cs
- SqlParameter.cs
- CellRelation.cs
- ChameleonKey.cs
- SimpleMailWebEventProvider.cs
- EditorPart.cs
- Emitter.cs
- SiteMapProvider.cs
- PagesChangedEventArgs.cs
- ForceCopyBuildProvider.cs
- DependencyPropertyValueSerializer.cs
- Config.cs
- Camera.cs
- SystemIPInterfaceProperties.cs
- ManagementClass.cs
- ResXBuildProvider.cs
- COMException.cs
- ConfigurationElementCollection.cs
- entitydatasourceentitysetnameconverter.cs
- sqlcontext.cs
- TypeDescriptionProviderAttribute.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- Schedule.cs
- FaultBookmark.cs
- BindingWorker.cs
- EventLogEntryCollection.cs
- CompoundFileIOPermission.cs
- VersionedStreamOwner.cs
- RectAnimationBase.cs
- diagnosticsswitches.cs
- GradientBrush.cs
- CacheEntry.cs
- DataGridGeneralPage.cs
- Misc.cs
- QueryContinueDragEventArgs.cs
- DependencyPropertyKey.cs
- XmlUtf8RawTextWriter.cs
- WizardStepCollectionEditor.cs
- WebPartActionVerb.cs
- bidPrivateBase.cs
- TranslateTransform3D.cs
- CompressStream.cs
- PasswordTextContainer.cs
- ProfessionalColors.cs
- SrgsRuleRef.cs
- BitmapEffect.cs
- Frame.cs
- AssemblyUtil.cs
- HtmlInputSubmit.cs
- XmlBoundElement.cs
- ContextMenuAutomationPeer.cs
- ConfigurationSectionGroup.cs
- TaskHelper.cs
- TemplateNameScope.cs
- WindowInteropHelper.cs
- CodeDomSerializerException.cs
- DiffuseMaterial.cs
- MulticastOption.cs
- SparseMemoryStream.cs
- WebServiceClientProxyGenerator.cs
- PreviewPageInfo.cs
- CssTextWriter.cs
- Int16.cs
- PointHitTestParameters.cs
- CursorInteropHelper.cs
- QilPatternFactory.cs
- DefaultShape.cs
- XhtmlCssHandler.cs
- RegularExpressionValidator.cs
- XmlIlVisitor.cs
- MarshalByRefObject.cs
- unitconverter.cs
- SiteMap.cs
- Missing.cs
- ListParagraph.cs
- InternalCache.cs
- LogicalChannel.cs
- DataSourceCache.cs
- SmiEventSink_DeferedProcessing.cs
- XmlSchemas.cs
- JournalEntry.cs
- FlowDocument.cs
- InputMethod.cs
- AsymmetricAlgorithm.cs
- DataSourceUtil.cs
- Int32Rect.cs
- MetafileHeaderWmf.cs
- PassportAuthentication.cs
- RewritingValidator.cs
- IconConverter.cs
- CapabilitiesAssignment.cs