Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / XPathNavigatorKeyComparer.cs / 1305376 / 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
- SortDescriptionCollection.cs
- SqlCharStream.cs
- CompensatableTransactionScopeActivityDesigner.cs
- BitmapEffectvisualstate.cs
- WmlCommandAdapter.cs
- ContentType.cs
- WorkflowDurableInstance.cs
- XmlSchemaImporter.cs
- OleDbSchemaGuid.cs
- Run.cs
- BitmapEffectGroup.cs
- XmlSchemaObjectTable.cs
- TextRangeBase.cs
- GridViewColumn.cs
- Error.cs
- FormParameter.cs
- JoinSymbol.cs
- TextBounds.cs
- HttpStreamMessage.cs
- CustomErrorsSection.cs
- DateTimeConverter2.cs
- WsdlHelpGeneratorElement.cs
- TextRunCacheImp.cs
- Subset.cs
- HttpWriter.cs
- UnsignedPublishLicense.cs
- InnerItemCollectionView.cs
- OracleBFile.cs
- IdnMapping.cs
- Padding.cs
- TrackBar.cs
- XPathChildIterator.cs
- TextServicesContext.cs
- Evidence.cs
- CollectionViewGroupInternal.cs
- Error.cs
- BCLDebug.cs
- DbSource.cs
- ComboBoxRenderer.cs
- WorkflowViewManager.cs
- Timer.cs
- DocumentPageView.cs
- AliasedExpr.cs
- InProcStateClientManager.cs
- DbgCompiler.cs
- AttachedPropertiesService.cs
- PointLightBase.cs
- ColumnBinding.cs
- ListSortDescription.cs
- ControllableStoryboardAction.cs
- TaiwanCalendar.cs
- PerformanceCountersElement.cs
- RepeatInfo.cs
- TextParagraphView.cs
- AppSettingsExpressionBuilder.cs
- ClassDataContract.cs
- BaseInfoTable.cs
- FormatConvertedBitmap.cs
- CompareInfo.cs
- SecurityDescriptor.cs
- ToolStripControlHost.cs
- StrongNameIdentityPermission.cs
- FocusWithinProperty.cs
- FilterQuery.cs
- CriticalFinalizerObject.cs
- RootBrowserWindowProxy.cs
- IgnoreSection.cs
- HostingPreferredMapPath.cs
- cache.cs
- GridSplitter.cs
- DataListItem.cs
- PersistenceTypeAttribute.cs
- SymbolPair.cs
- OutKeywords.cs
- fixedPageContentExtractor.cs
- WebBrowserNavigatedEventHandler.cs
- SctClaimDictionary.cs
- EmissiveMaterial.cs
- CallbackDebugElement.cs
- _CookieModule.cs
- ListView.cs
- NullableConverter.cs
- DataGridColumnCollection.cs
- TcpHostedTransportConfiguration.cs
- TemplateControlParser.cs
- ExpressionBuilderContext.cs
- Accessors.cs
- VisualCollection.cs
- FormViewModeEventArgs.cs
- SqlRowUpdatingEvent.cs
- SmiSettersStream.cs
- FigureParagraph.cs
- FillBehavior.cs
- DataSourceControl.cs
- InvalidWMPVersionException.cs
- PreDigestedSignedInfo.cs
- ServiceTimeoutsElement.cs
- QuaternionConverter.cs
- GridLengthConverter.cs
- RoleGroup.cs