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
- ToolStripOverflow.cs
- XmlValidatingReader.cs
- OleDbPermission.cs
- OrderedDictionary.cs
- PropertyPathWorker.cs
- ExternalFile.cs
- MemoryMappedViewStream.cs
- BaseDataBoundControl.cs
- DLinqDataModelProvider.cs
- ManagementPath.cs
- IIS7WorkerRequest.cs
- DbConnectionClosed.cs
- ReflectTypeDescriptionProvider.cs
- SqlCommandSet.cs
- ResourceReferenceExpression.cs
- ReachPageContentSerializerAsync.cs
- PackWebResponse.cs
- InstallerTypeAttribute.cs
- EarlyBoundInfo.cs
- TemplatePropertyEntry.cs
- StrokeIntersection.cs
- CopyOfAction.cs
- CancellationState.cs
- ExpressionBuilderContext.cs
- RelationshipConverter.cs
- ImplicitInputBrush.cs
- TileModeValidation.cs
- PatternMatcher.cs
- OdbcConnectionFactory.cs
- BufferBuilder.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- dbenumerator.cs
- MessageQueueTransaction.cs
- ControlCollection.cs
- ProviderConnectionPoint.cs
- JoinSymbol.cs
- Util.cs
- XmlObjectSerializerContext.cs
- ActiveDocumentEvent.cs
- ActionMessageFilter.cs
- TimerElapsedEvenArgs.cs
- ProvidersHelper.cs
- ButtonBaseAdapter.cs
- TableRowCollection.cs
- ObjectList.cs
- QueryExtender.cs
- RuleInfoComparer.cs
- EventTask.cs
- BeginEvent.cs
- AssemblyBuilderData.cs
- MouseDevice.cs
- ProfileSettingsCollection.cs
- BindingsCollection.cs
- BoundColumn.cs
- Marshal.cs
- TextServicesContext.cs
- _Connection.cs
- UnionCodeGroup.cs
- LineUtil.cs
- HttpDictionary.cs
- HttpCapabilitiesBase.cs
- WebProxyScriptElement.cs
- BaseParaClient.cs
- RenamedEventArgs.cs
- PinProtectionHelper.cs
- DiagnosticTraceRecords.cs
- BitmapDownload.cs
- MemoryFailPoint.cs
- MailDefinition.cs
- InputMethodStateChangeEventArgs.cs
- ByteFacetDescriptionElement.cs
- CatalogZoneBase.cs
- CompositeDispatchFormatter.cs
- UriParserTemplates.cs
- EmptyImpersonationContext.cs
- SQLResource.cs
- ComPlusAuthorization.cs
- Types.cs
- ErrorActivity.cs
- StringStorage.cs
- TabPanel.cs
- webproxy.cs
- ExtensionQuery.cs
- ResourceManager.cs
- SchemaInfo.cs
- TextContainerChangedEventArgs.cs
- IndicCharClassifier.cs
- OleStrCAMarshaler.cs
- FileLoadException.cs
- WindowPatternIdentifiers.cs
- RangeBase.cs
- PrimitiveCodeDomSerializer.cs
- DateTimeOffset.cs
- SoapFaultCodes.cs
- TextTreeExtractElementUndoUnit.cs
- CustomErrorsSection.cs
- FormsIdentity.cs
- OperationAbortedException.cs
- SiteMapNode.cs
- ConfigurationManagerHelperFactory.cs